From patchwork Wed Dec 9 13:31:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58056 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp670277lbb; Wed, 9 Dec 2015 05:31:44 -0800 (PST) X-Received: by 10.66.139.72 with SMTP id qw8mr7266480pab.130.1449667904525; Wed, 09 Dec 2015 05:31:44 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si12793619pfj.115.2015.12.09.05.31.44; Wed, 09 Dec 2015 05:31:44 -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 S1754458AbbLINbn (ORCPT + 4 others); Wed, 9 Dec 2015 08:31:43 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:35096 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754327AbbLINbm (ORCPT ); Wed, 9 Dec 2015 08:31:42 -0500 Received: by lbpu9 with SMTP id u9so29817824lbp.2 for ; Wed, 09 Dec 2015 05:31:41 -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=anwA2MdzUuOQFRW8uUN23OfXqnBy/YQ57CGCiSoa/Ek=; b=L5ODHVpQwxqr0Uh6uPOXtqfeSX/iLgP+S2mGtqOSeXHV63zYWH/N7HfwsOLu6UTsLc kbKpWmSfqIoQEWT6Bk5cVNJnREMEC/OnHbp1sd6rMWItNc55c3FxLeTvFsMzaeG09cUr AIu3zdMGpqn9sfq24kfTdt5wT1lZtB0ugX+HVbU/SXmtQmTBn/9v5iCmIwUCsKWA8zj9 btQJTQ2TePtYwZjXUXOZtmWRzosTk4C9wN+3DLxt/0sY9qJM/yFxilxV264n6AtXpoX4 QVzSqeNcMyDw+Jr1Jxlchhi7VGa/Kk+z7sytftCmEb9ynfRMuUqWUUSWZ5S8KmFrYadF gp6A== 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=anwA2MdzUuOQFRW8uUN23OfXqnBy/YQ57CGCiSoa/Ek=; b=D5FgyN8nntEtPYn2+HWM7y8c5HN4RcGq5t10weQzI2awg3yAIsFT5dlk3fFmHClFjo H9Fo6znLYf2+55B2y4e8T+LMNwQAATfsqZkuhDg9wTd5USZKtoCY7cKzIqM6t1+2DZfK 86IxFQltyX1KEvwkxGSGSkD9j9jSj8OuqWP5kAmVHSb9/J/WSkEK9LZ8A7agOj99TwEj +PF19/9qu+/l3nSTBW14PRmAzOsoKnOy1ySGh4eTs+tyEp8tm25IdY/fl3bmiTUj6GDN etNzRlyV5WXbanr46xLbKTO/IhIGT2483JQKFnP60defNYea3Hc7pCRy/97wbVE5r79Q unTg== X-Gm-Message-State: ALoCoQmEMYzRMSP+Zjiw0S7V+At686zepGGqyNO4DP7Ud5/PBn5GxeRs0Iq3nA0V+OmGaE0hOPMSISFqUOrwPoHVoqh8woMmDQ== X-Received: by 10.112.199.71 with SMTP id ji7mr2296757lbc.61.1449667901572; Wed, 09 Dec 2015 05:31:41 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id f71sm1444307lfe.36.2015.12.09.05.31.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:31:40 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Andrew Bresticker , Mallikarjun Kasoju , Laxman Dewangan Subject: [PATCH 100/182] pinctrl: as3722: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:31:37 +0100 Message-Id: <1449667897-2450-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: Andrew Bresticker Cc: Mallikarjun Kasoju Cc: Laxman Dewangan Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-as3722.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 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/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c index 89479bea6262..e844fdc6d3a8 100644 --- a/drivers/pinctrl/pinctrl-as3722.c +++ b/drivers/pinctrl/pinctrl-as3722.c @@ -436,14 +436,9 @@ static struct pinctrl_desc as3722_pinctrl_desc = { .owner = THIS_MODULE, }; -static inline struct as3722_pctrl_info *to_as_pci(struct gpio_chip *chip) -{ - return container_of(chip, struct as3722_pctrl_info, gpio_chip); -} - static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct as3722_pctrl_info *as_pci = to_as_pci(chip); + struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip); struct as3722 *as3722 = as_pci->as3722; int ret; u32 reg; @@ -491,7 +486,7 @@ static int as3722_gpio_get(struct gpio_chip *chip, unsigned offset) static void as3722_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct as3722_pctrl_info *as_pci = to_as_pci(chip); + struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip); struct as3722 *as3722 = as_pci->as3722; int en_invert; u32 val; @@ -531,7 +526,7 @@ static int as3722_gpio_direction_output(struct gpio_chip *chip, static int as3722_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct as3722_pctrl_info *as_pci = to_as_pci(chip); + struct as3722_pctrl_info *as_pci = gpiochip_get_data(chip); return as3722_irq_get_virq(as_pci->as3722, offset); } @@ -584,7 +579,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) as_pci->gpio_chip = as3722_gpio_chip; as_pci->gpio_chip.parent = &pdev->dev; as_pci->gpio_chip.of_node = pdev->dev.parent->of_node; - ret = gpiochip_add(&as_pci->gpio_chip); + ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci); if (ret < 0) { dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret); goto fail_chip_add;