From patchwork Wed Dec 9 13:14:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57965 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp659994lbb; Wed, 9 Dec 2015 05:14:15 -0800 (PST) X-Received: by 10.66.248.106 with SMTP id yl10mr7737674pac.140.1449666851980; Wed, 09 Dec 2015 05:14:11 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26si12711651pfi.57.2015.12.09.05.14.11; Wed, 09 Dec 2015 05:14:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro-org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754086AbbLINOK (ORCPT + 4 others); Wed, 9 Dec 2015 08:14:10 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:36018 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754080AbbLINOI (ORCPT ); Wed, 9 Dec 2015 08:14:08 -0500 Received: by lfs39 with SMTP id 39so34093646lfs.3 for ; Wed, 09 Dec 2015 05:14:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=a//ua93RBfI+EkD3Zd0/CMw22TCYONNTIf4wbjhW9Wg=; b=c/9St1H6AZYr1j6jcsO3NOOO9vm6ClETKhQekm3vnKJ4GyZ6yRIcaPJddY6D4giRc0 eT+3/CdjpGg1NEiC6lzBvbPn2315YhV6NQpilQttRR7BKCE28bUeL6Z4b0vDG3BPE+FL Hn6c6vYe757y8BPRrWCR2qQ9PE6wNAEWPEaJ7FH8fyRNmVV64EulE6opOd8bvbb/OHhr COqBcRTpNW2v/6BEB2F4gDBFL2c2oKQFzPXJyqu2v0gDQj/KQsU10e6yE3PgBBIMlvW1 knUDyA38gd3ykaJfpBJfPgeWILCQ9rvMP6De8wHgR5Jjdibpz/nQbQcDLgItJutVsx3i pKjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=a//ua93RBfI+EkD3Zd0/CMw22TCYONNTIf4wbjhW9Wg=; b=BlVy+YJ/NmBOkLk98cVaAUOEoj6UNlsbYoMtcZP0BJTsxMcxm8H8GdWA54APSCPQaM SFAggLmBgucBxXh6zPieuJOO6Z9V8yUbaT73xE/adXsiRKoITJ8EeCNorXoVYfQ836FQ Ghf/EbQVNybCb8GUPWJ9noo/FSDurgRcKienvDvzbsUPFwUJJz57Hgstyty6yuarUrZl grOoIlasosCSjXegcpOqaz384SaSLRhDq0lf7r18KhLR2a6g+ULAGchE1fubBSQiiD6q YzdQHHoKyoAdH3aUy+Jk1sw/OSURqFBsoHmVc7ZSTvUO678OJ0RDVvUda+AtvXqQQV/9 LS1Q== X-Gm-Message-State: ALoCoQmr+UOLFCj5Le2678hVcNsUgo9NA0ZZqt4AA8C74EMMIvm1JB4j7nSB6ozE5JgZi97yybB4zKOD1kEd0jlnpu1/Aj+E4g== X-Received: by 10.25.207.205 with SMTP id f196mr2191810lfg.124.1449666847156; Wed, 09 Dec 2015 05:14:07 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h9sm1398633lbj.42.2015.12.09.05.14.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:14:06 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Jean-Francois Dagenais Subject: [PATCH 010/182] gpio: adp5588: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:14:03 +0100 Message-Id: <1449666843-30216-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: Jean-Francois Dagenais Signed-off-by: Linus Walleij --- drivers/gpio/gpio-adp5588.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 984186ee58a0..19a0eba1e942 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c @@ -65,8 +65,7 @@ static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val) static int adp5588_gpio_get_value(struct gpio_chip *chip, unsigned off) { - struct adp5588_gpio *dev = - container_of(chip, struct adp5588_gpio, gpio_chip); + struct adp5588_gpio *dev = gpiochip_get_data(chip); unsigned bank = ADP5588_BANK(off); unsigned bit = ADP5588_BIT(off); int val; @@ -87,8 +86,7 @@ static void adp5588_gpio_set_value(struct gpio_chip *chip, unsigned off, int val) { unsigned bank, bit; - struct adp5588_gpio *dev = - container_of(chip, struct adp5588_gpio, gpio_chip); + struct adp5588_gpio *dev = gpiochip_get_data(chip); bank = ADP5588_BANK(off); bit = ADP5588_BIT(off); @@ -108,8 +106,7 @@ static int adp5588_gpio_direction_input(struct gpio_chip *chip, unsigned off) { int ret; unsigned bank; - struct adp5588_gpio *dev = - container_of(chip, struct adp5588_gpio, gpio_chip); + struct adp5588_gpio *dev = gpiochip_get_data(chip); bank = ADP5588_BANK(off); @@ -126,8 +123,7 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip, { int ret; unsigned bank, bit; - struct adp5588_gpio *dev = - container_of(chip, struct adp5588_gpio, gpio_chip); + struct adp5588_gpio *dev = gpiochip_get_data(chip); bank = ADP5588_BANK(off); bit = ADP5588_BIT(off); @@ -152,8 +148,8 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip, #ifdef CONFIG_GPIO_ADP5588_IRQ static int adp5588_gpio_to_irq(struct gpio_chip *chip, unsigned off) { - struct adp5588_gpio *dev = - container_of(chip, struct adp5588_gpio, gpio_chip); + struct adp5588_gpio *dev = gpiochip_get_data(chip); + return dev->irq_base + off; } @@ -418,7 +414,7 @@ static int adp5588_gpio_probe(struct i2c_client *client, } } - ret = gpiochip_add(&dev->gpio_chip); + ret = gpiochip_add_data(&dev->gpio_chip, dev); if (ret) goto err_irq;