From patchwork Wed Dec 9 13:31:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58052 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp669976lbb; Wed, 9 Dec 2015 05:31:16 -0800 (PST) X-Received: by 10.98.67.201 with SMTP id l70mr12815343pfi.29.1449667874788; Wed, 09 Dec 2015 05:31:14 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si12770236pfk.134.2015.12.09.05.31.14; Wed, 09 Dec 2015 05:31: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 S1754526AbbLINbO (ORCPT + 4 others); Wed, 9 Dec 2015 08:31:14 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:32925 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754518AbbLINbL (ORCPT ); Wed, 9 Dec 2015 08:31:11 -0500 Received: by lfaz4 with SMTP id z4so34269795lfa.0 for ; Wed, 09 Dec 2015 05:31:10 -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=HZX2k36eWlocXBWcrBpsOmv0fINM4CyKCdodFPnNJUk=; b=vWnOO6etqEIXTNukWmher62WZvX6y9CzWpAr+bVj9A/vsvEGL0vahz3V8RkYYS4INf tRm9QV/RX770feeNaK9roKPBLsBbbyx2hSClXlhcUBjUaz29yrEg5GtwPxpgHxAOG0H9 ONxFNlEYLm6PmTeqquPZB5WSQ3iu6ro4BJISjhdbQuskU5QsZ50xCcMCbCNBydjIC3bT biIZlIcLsKd53Smci4gR41bScfRKnRxVlGQ1/WiHVz5XCzzToY028UyMDs6RQX6D+xc9 tJa0ZQNUdwWEukoH45lKXFxITDqblUMujx9Fj97QMbtrZim6H2cX34eli6eBLMwG9GGq 9BMw== 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=HZX2k36eWlocXBWcrBpsOmv0fINM4CyKCdodFPnNJUk=; b=CspRnaEjaW7dZ7TitAn0WutGr3nKx2CwrGu7k3/XOwyX68f4n7gHrY8TsXTLFXpuR3 aJUsv+uVp4ivSdOwZqksPbMmGHAjd5ju8qA+tfHD4YDHLku2TjXce9ec2hG96L5JqHT9 MBjExEB2lLiTQPDxQazDD0KhuCkSomGL8AMz+Lcm6l1Twyb580/vP5FjDapUntjiLfwU 6Ft4uS6EuHyRygXh0dQqBq+FZiivRpCKJkNeFgwf/vxO+L4EYnje5todBeyPGu64EyMI YsX1yuZhA8GW7Gd+Jk5s42CL+0yAxzdoK3+EDsbX7BF9oSAbI07+NFrtRFBKEPFLtAFj RTGA== X-Gm-Message-State: ALoCoQlKv+ckazzPOuzJu0mLOmpGt3JPn4vLaqymKd96cTesrrEEAU86a85mGPRLsseRzs7W4VRY8zSRlG4vh02i3o01RB/FRA== X-Received: by 10.25.81.13 with SMTP id f13mr2501591lfb.126.1449667870093; Wed, 09 Dec 2015 05:31:10 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o70sm749437lfi.25.2015.12.09.05.31.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:31:09 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij Subject: [PATCH 096/182] pinctrl: nomadik: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:31:05 +0100 Message-Id: <1449667865-2198-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(). Signed-off-by: Linus Walleij --- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 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/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c index cb4a327425a0..352406108fa0 100644 --- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c +++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c @@ -646,7 +646,7 @@ static inline int nmk_gpio_get_bitmask(int gpio) static void nmk_gpio_irq_ack(struct irq_data *d) { struct gpio_chip *chip = irq_data_get_irq_chip_data(d); - struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); clk_enable(nmk_chip->clk); writel(nmk_gpio_get_bitmask(d->hwirq), nmk_chip->addr + NMK_GPIO_IC); @@ -863,7 +863,7 @@ static void __nmk_gpio_irq_handler(struct irq_desc *desc, u32 status) static void nmk_gpio_irq_handler(struct irq_desc *desc) { struct gpio_chip *chip = irq_desc_get_handler_data(desc); - struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); u32 status; clk_enable(nmk_chip->clk); @@ -876,7 +876,7 @@ static void nmk_gpio_irq_handler(struct irq_desc *desc) static void nmk_gpio_latent_irq_handler(struct irq_desc *desc) { struct gpio_chip *chip = irq_desc_get_handler_data(desc); - struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); u32 status = nmk_chip->get_latent_status(nmk_chip->bank); __nmk_gpio_irq_handler(desc, status); @@ -886,8 +886,7 @@ static void nmk_gpio_latent_irq_handler(struct irq_desc *desc) static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) { - struct nmk_gpio_chip *nmk_chip = - container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); clk_enable(nmk_chip->clk); @@ -900,8 +899,7 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) { - struct nmk_gpio_chip *nmk_chip = - container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); u32 bit = 1 << offset; int value; @@ -917,8 +915,7 @@ static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, int val) { - struct nmk_gpio_chip *nmk_chip = - container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); clk_enable(nmk_chip->clk); @@ -930,8 +927,7 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset, int val) { - struct nmk_gpio_chip *nmk_chip = - container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); clk_enable(nmk_chip->clk); @@ -951,8 +947,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s, unsigned offset, unsigned gpio) { const char *label = gpiochip_is_requested(chip, offset); - struct nmk_gpio_chip *nmk_chip = - container_of(chip, struct nmk_gpio_chip, chip); + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); int mode; bool is_out; bool data_out; @@ -1278,7 +1273,7 @@ static int nmk_gpio_probe(struct platform_device *dev) clk_disable(nmk_chip->clk); chip->of_node = np; - ret = gpiochip_add(chip); + ret = gpiochip_add_data(chip, nmk_chip); if (ret) return ret; @@ -1789,7 +1784,7 @@ static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev, return -EINVAL; } chip = range->gc; - nmk_chip = container_of(chip, struct nmk_gpio_chip, chip); + nmk_chip = gpiochip_get_data(chip); dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset);