From patchwork Wed Dec 9 13:16:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57981 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp661395lbb; Wed, 9 Dec 2015 05:16:27 -0800 (PST) X-Received: by 10.98.72.71 with SMTP id v68mr13028506pfa.40.1449666987875; Wed, 09 Dec 2015 05:16:27 -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.16.27; Wed, 09 Dec 2015 05:16:27 -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 S1753156AbbLINQ1 (ORCPT + 4 others); Wed, 9 Dec 2015 08:16:27 -0500 Received: from mail-lb0-f177.google.com ([209.85.217.177]:33979 "EHLO mail-lb0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbbLINQ0 (ORCPT ); Wed, 9 Dec 2015 08:16:26 -0500 Received: by lbbcs9 with SMTP id cs9so29689358lbb.1 for ; Wed, 09 Dec 2015 05:16:25 -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=juBg7wW2VN0kfTcLtxFZ5bxeyJlTlMhSiAWOiMF/HcU=; b=ejgiHqN2bYPpP3kfqm4BkCd6uSk3zMG8dB5nIc/03ly+a9EQLkA13jlucqOCCERlpg YxFdpW80xlZVCEpJ1khIxy/sD8Mb5Xxfp6otSCbCZbe+fX2nMiHcdGTDCfa8tNVZJGGS qEiX7mhyELR4PvCMWTWOgvXaq/xs+jthkkO+UZXc1Kwo9FrAb1RwrSStXwUkMC4r0tzn rW1hdKbFqFaZvuOHfJFYJm4FoZDng42b+19nq6Ir1EoxozaPcsaJWnVud8tst9Gr96E/ 24uXjVBR/kPt0kpenI5R0AtE2Qklb0pbKEGpFfqP5BfwrTiyPbE4lNX7gHwAMdzOWaMy Twaw== 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=juBg7wW2VN0kfTcLtxFZ5bxeyJlTlMhSiAWOiMF/HcU=; b=VZ9N1/7FypUHDclgH1fTk6T/G16eoKQHwnF3EdfzhQZiDM39H7U+YoY1X3ebzM21LH T4hXXjl1vEs3whjYV2t2/urfHuDNOY13v0a0XfwYPPMmzjsFYdFyy/9EfogGa+kEK3tP VyShYnln1WSReP4kPgmfw7XluzMA0wHVtTnLj5bqK7kRMvebIQ87NLUV9Xx5q9+WKE0k VkYzCe4I9NKbdpA0JCU362/gVT3gUJjVigqCppDdprCAyhQPb7P+G8h562HiYEFrdArk S2lG8ckL3CfllHckiHc9GpPhEB5qLxSJjHaI6bGzjWn8a6D2199bOIUEeKq8ITmRnTSv +vew== X-Gm-Message-State: ALoCoQmu84/QT992eV6lbNNTtTkBHpscLc/TyZ8fCv3yXKfwTdu3dLAhN/2jdBxUVUNoQ3XqnLv3SJYZxKBBpkk9AkzQJCwFGg== X-Received: by 10.112.16.226 with SMTP id j2mr810429lbd.138.1449666985225; Wed, 09 Dec 2015 05:16:25 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id o67sm1421035lfo.33.2015.12.09.05.16.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:16:24 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , David Cohen Subject: [PATCH 026/182] gpio: intel-mid: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:16:21 +0100 Message-Id: <1449666981-30980-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: David Cohen Signed-off-by: Linus Walleij --- drivers/gpio/gpio-intel-mid.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-intel-mid.c b/drivers/gpio/gpio-intel-mid.c index 1c46a7ef2680..6b7957a1f0b0 100644 --- a/drivers/gpio/gpio-intel-mid.c +++ b/drivers/gpio/gpio-intel-mid.c @@ -78,15 +78,10 @@ struct intel_mid_gpio { struct pci_dev *pdev; }; -static inline struct intel_mid_gpio *to_intel_gpio_priv(struct gpio_chip *gc) -{ - return container_of(gc, struct intel_mid_gpio, chip); -} - static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, enum GPIO_REG reg_type) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); unsigned nreg = chip->ngpio / 32; u8 reg = offset / 32; @@ -96,7 +91,7 @@ static void __iomem *gpio_reg(struct gpio_chip *chip, unsigned offset, static void __iomem *gpio_reg_2bit(struct gpio_chip *chip, unsigned offset, enum GPIO_REG reg_type) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); unsigned nreg = chip->ngpio / 32; u8 reg = offset / 16; @@ -138,7 +133,7 @@ static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); void __iomem *gpdr = gpio_reg(chip, offset, GPDR); u32 value; unsigned long flags; @@ -161,7 +156,7 @@ static int intel_gpio_direction_input(struct gpio_chip *chip, unsigned offset) static int intel_gpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) { - struct intel_mid_gpio *priv = to_intel_gpio_priv(chip); + struct intel_mid_gpio *priv = gpiochip_get_data(chip); void __iomem *gpdr = gpio_reg(chip, offset, GPDR); unsigned long flags; @@ -185,7 +180,7 @@ static int intel_gpio_direction_output(struct gpio_chip *chip, static int intel_mid_irq_type(struct irq_data *d, unsigned type) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_mid_gpio *priv = to_intel_gpio_priv(gc); + struct intel_mid_gpio *priv = gpiochip_get_data(gc); u32 gpio = irqd_to_hwirq(d); unsigned long flags; u32 value; @@ -304,7 +299,7 @@ MODULE_DEVICE_TABLE(pci, intel_gpio_ids); static void intel_mid_irq_handler(struct irq_desc *desc) { struct gpio_chip *gc = irq_desc_get_handler_data(desc); - struct intel_mid_gpio *priv = to_intel_gpio_priv(gc); + struct intel_mid_gpio *priv = gpiochip_get_data(gc); struct irq_data *data = irq_desc_get_irq_data(desc); struct irq_chip *chip = irq_data_get_irq_chip(data); u32 base, gpio, mask; @@ -406,7 +401,7 @@ static int intel_gpio_probe(struct pci_dev *pdev, spin_lock_init(&priv->lock); pci_set_drvdata(pdev, priv); - retval = gpiochip_add(&priv->chip); + retval = gpiochip_add_data(&priv->chip, priv); if (retval) { dev_err(&pdev->dev, "gpiochip_add error %d\n", retval); return retval;