From patchwork Wed Dec 9 13:21:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58008 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp664877lbb; Wed, 9 Dec 2015 05:22:14 -0800 (PST) X-Received: by 10.98.68.83 with SMTP id r80mr12703996pfa.120.1449667334542; Wed, 09 Dec 2015 05:22:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y79si12719779pfa.175.2015.12.09.05.22.14; Wed, 09 Dec 2015 05:22:14 -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 S1754522AbbLINWG (ORCPT + 4 others); Wed, 9 Dec 2015 08:22:06 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:34610 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754461AbbLINWF (ORCPT ); Wed, 9 Dec 2015 08:22:05 -0500 Received: by lbbcs9 with SMTP id cs9so29784743lbb.1 for ; Wed, 09 Dec 2015 05:22:04 -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=NU9oYdn0In+WZdUcXq5mmjcaV8k6mWoaqDR+By1o9YY=; b=FqVRd9hRk9eqoQKePtjYPbO0Xhun3u4E1U7pry+/UEA0SpxWueUwIoEJL2DBdxcYAJ P2wXRsb88jygKQ/r3EZs28Fxb6uDOHisZ9nVudoGqc1o6MfxNv1mvTfVjdOWO4OaO195 9RCgg5w1xUgqNZ83SDVl8oJvxyC8TZUHv6lzP001NCVQNNF6qECcJQWb+Iqwp0NEaWpk dmBmiKTkSWcCszvbGkoCTI/jYpl5tBH9UW/1Kz0fHE3p6rSefoaEjo+cowrsRgPLfW6k u9F8nlYw/waHY+4GGGgPyvx8OYNHkeVOGkFw7VrYZfiqpLo8XNqrGFFPdsul3Ma3LIoO kNJw== 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=NU9oYdn0In+WZdUcXq5mmjcaV8k6mWoaqDR+By1o9YY=; b=lJAwxKxTXLn/vBzppfZeBJwWwOdqqWXxU7oRXCV3agGvX9ZplYOUnwvcvu4g8+IPaY Y5Eyj3KFZIyvoKyhNLKVtzKmdULyNZinp30MFm3W2p+z3i0lh8T+/jgdoPtwd6+wakPD L6JZtHjOI2cwLfIIjD/LFwGi2pt0M/GD41NAYBfaGblUtL8vC9FOjjfi4fgizO7SHjdH ernCiHJSpb/zgLMJ6x729qFUBcVP7/8jkmQd2dXSdJwdSA5g2NT1i8fGC+cVJ0+1Me/J iGZmkDODL3nRmah4KP951ddZREXmXpp7IquivCVwO00ThuDBhZqVYFnx8987eI8LNOsg /F/g== X-Gm-Message-State: ALoCoQnpHWnqG/du+HoQRrZSTAS9wRyGMsY2b8xjK20Tn3dZ+pIjNB7RkepnheaVcnUJwm68LdagSwnJGbJ2HdVa3tZrdcgCCQ== X-Received: by 10.112.131.1 with SMTP id oi1mr2327738lbb.35.1449667323860; Wed, 09 Dec 2015 05:22:03 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id mp1sm1394597lbb.43.2015.12.09.05.22.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:22:03 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Laxman Dewangan Subject: [PATCH 053/182] gpio: rc5t583: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:21:59 +0100 Message-Id: <1449667319-32294-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: Laxman Dewangan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-rc5t583.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 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-rc5t583.c b/drivers/gpio/gpio-rc5t583.c index f26d9f7d8cdd..1e2d210b3369 100644 --- a/drivers/gpio/gpio-rc5t583.c +++ b/drivers/gpio/gpio-rc5t583.c @@ -34,14 +34,9 @@ struct rc5t583_gpio { struct rc5t583 *rc5t583; }; -static inline struct rc5t583_gpio *to_rc5t583_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct rc5t583_gpio, gpio_chip); -} - static int rc5t583_gpio_get(struct gpio_chip *gc, unsigned int offset) { - struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc); + struct rc5t583_gpio *rc5t583_gpio = gpiochip_get_data(gc); struct device *parent = rc5t583_gpio->rc5t583->dev; uint8_t val = 0; int ret; @@ -55,7 +50,7 @@ static int rc5t583_gpio_get(struct gpio_chip *gc, unsigned int offset) static void rc5t583_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) { - struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc); + struct rc5t583_gpio *rc5t583_gpio = gpiochip_get_data(gc); struct device *parent = rc5t583_gpio->rc5t583->dev; if (val) rc5t583_set_bits(parent, RC5T583_GPIO_IOOUT, BIT(offset)); @@ -65,7 +60,7 @@ static void rc5t583_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) static int rc5t583_gpio_dir_input(struct gpio_chip *gc, unsigned int offset) { - struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc); + struct rc5t583_gpio *rc5t583_gpio = gpiochip_get_data(gc); struct device *parent = rc5t583_gpio->rc5t583->dev; int ret; @@ -80,7 +75,7 @@ static int rc5t583_gpio_dir_input(struct gpio_chip *gc, unsigned int offset) static int rc5t583_gpio_dir_output(struct gpio_chip *gc, unsigned offset, int value) { - struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc); + struct rc5t583_gpio *rc5t583_gpio = gpiochip_get_data(gc); struct device *parent = rc5t583_gpio->rc5t583->dev; int ret; @@ -95,7 +90,7 @@ static int rc5t583_gpio_dir_output(struct gpio_chip *gc, unsigned offset, static int rc5t583_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc); + struct rc5t583_gpio *rc5t583_gpio = gpiochip_get_data(gc); if (offset < RC5T583_MAX_GPIO) return rc5t583_gpio->rc5t583->irq_base + @@ -105,7 +100,7 @@ static int rc5t583_gpio_to_irq(struct gpio_chip *gc, unsigned offset) static void rc5t583_gpio_free(struct gpio_chip *gc, unsigned offset) { - struct rc5t583_gpio *rc5t583_gpio = to_rc5t583_gpio(gc); + struct rc5t583_gpio *rc5t583_gpio = gpiochip_get_data(gc); struct device *parent = rc5t583_gpio->rc5t583->dev; rc5t583_set_bits(parent, RC5T583_GPIO_PGSEL, BIT(offset)); @@ -141,7 +136,7 @@ static int rc5t583_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, rc5t583_gpio); - return gpiochip_add(&rc5t583_gpio->gpio_chip); + return gpiochip_add_data(&rc5t583_gpio->gpio_chip, rc5t583_gpio); } static int rc5t583_gpio_remove(struct platform_device *pdev)