From patchwork Wed Dec 9 13:30:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58051 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp669931lbb; Wed, 9 Dec 2015 05:31:12 -0800 (PST) X-Received: by 10.66.150.198 with SMTP id uk6mr7930689pab.70.1449667871786; Wed, 09 Dec 2015 05:31:11 -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.11; Wed, 09 Dec 2015 05:31: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 S1754476AbbLINa4 (ORCPT + 4 others); Wed, 9 Dec 2015 08:30:56 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:34120 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754451AbbLINaz (ORCPT ); Wed, 9 Dec 2015 08:30:55 -0500 Received: by lffu14 with SMTP id u14so34285097lff.1 for ; Wed, 09 Dec 2015 05:30:53 -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=sn/Mdfrg97MhgWvBU1jfkvdSEwzNj9QsDd66E5sCHZ0=; b=XZbldN5iY09wHm5VvE0Vnv7qgcnxu0jS5GCk5CFK/yuqR0FAhLNxlaCDSW13XgZ9n3 EDmqty9UF2EXBYuTtEJDGQdXMR4zeMWOe/95sASOsCcnDaZ/pT9NKotw1ULjTJoU8CET Co22/LOGG4x7VHXi952ewqm9wrtEmv8c14jPszuyN7D4x1JNCHNm8K9w9nN1qRZQgq+m PGddJvQkUJEaMG4CtheS6yIV8tpmSlVw6+jt13FX4PM3+4ptOUb46zC65mHAVjFYNjc3 E7IBFaV9gOpbWlV/L+l69+IPbaPBtY6aNo/Gol9W/ngXs8Ue+8QPe1Bu+mycghib0cfz Fv7w== 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=sn/Mdfrg97MhgWvBU1jfkvdSEwzNj9QsDd66E5sCHZ0=; b=DjbyvN+wYW8jb5K4RWAagq4uzMH6EwN9vIcBcGI8mY9dQbP21y16sGthPkm2+wO9w/ 6fXifn8wMiSlPFZOPuUag34/QHZJJ/j8lBo6whzcMgpVjhsKgJ1k4MfzS5EF2e7Bv4w2 uQ8pfnLuTnX7ms5rXBE3xJZVjQzcZ+NAT3tn7FoBZwyqb44RqQDBZKF1P+3FM6YNS1gg 0/YIylntkrKIR5sHFo33WjbaJEEz5BbEymBXar2xC4x3iVxeFVQx5jrOgnmgxs+fzVyX So2GpMV7qI8sdn997B6TGpWohJWEdTRkVBbr7et+CiGZY7VzAVKyXFgxFwbYKbdLO2sq 0z5g== X-Gm-Message-State: ALoCoQnzpAbJrNj88iHE/jAPMqmK4UKmjhambb99WpDRGacoGohl55ay08ndPJMUIuCjYD6tKo/tznaocC/KbRjZAFYpUIev0w== X-Received: by 10.25.138.136 with SMTP id m130mr2270640lfd.2.1449667853846; Wed, 09 Dec 2015 05:30:53 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id i194sm1431612lfg.20.2015.12.09.05.30.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:30:53 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Mika Westerberg , Heikki Krogerus Subject: [PATCH 094/182] pinctrl: intel: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:30:50 +0100 Message-Id: <1449667850-2059-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: Mika Westerberg Cc: Heikki Krogerus Signed-off-by: Linus Walleij --- drivers/pinctrl/intel/pinctrl-intel.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 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/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c index 401c186244be..9597f57f07a0 100644 --- a/drivers/pinctrl/intel/pinctrl-intel.c +++ b/drivers/pinctrl/intel/pinctrl-intel.c @@ -105,7 +105,6 @@ struct intel_pinctrl { struct intel_pinctrl_context context; }; -#define gpiochip_to_pinctrl(c) container_of(c, struct intel_pinctrl, chip) #define pin_to_padno(c, p) ((p) - (c)->pin_base) static struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, @@ -598,7 +597,7 @@ static const struct pinctrl_desc intel_pinctrl_desc = { static int intel_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(chip); + struct intel_pinctrl *pctrl = gpiochip_get_data(chip); void __iomem *reg; reg = intel_get_padcfg(pctrl, offset, PADCFG0); @@ -610,7 +609,7 @@ static int intel_gpio_get(struct gpio_chip *chip, unsigned offset) static void intel_gpio_set(struct gpio_chip *chip, unsigned offset, int value) { - struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(chip); + struct intel_pinctrl *pctrl = gpiochip_get_data(chip); void __iomem *reg; reg = intel_get_padcfg(pctrl, offset, PADCFG0); @@ -654,7 +653,7 @@ static const struct gpio_chip intel_gpio_chip = { static void intel_gpio_irq_ack(struct irq_data *d) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc); + struct intel_pinctrl *pctrl = gpiochip_get_data(gc); const struct intel_community *community; unsigned pin = irqd_to_hwirq(d); @@ -675,7 +674,7 @@ static void intel_gpio_irq_ack(struct irq_data *d) static void intel_gpio_irq_mask_unmask(struct irq_data *d, bool mask) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc); + struct intel_pinctrl *pctrl = gpiochip_get_data(gc); const struct intel_community *community; unsigned pin = irqd_to_hwirq(d); unsigned long flags; @@ -715,7 +714,7 @@ static void intel_gpio_irq_unmask(struct irq_data *d) static int intel_gpio_irq_type(struct irq_data *d, unsigned type) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc); + struct intel_pinctrl *pctrl = gpiochip_get_data(gc); unsigned pin = irqd_to_hwirq(d); unsigned long flags; void __iomem *reg; @@ -769,7 +768,7 @@ static int intel_gpio_irq_type(struct irq_data *d, unsigned type) static int intel_gpio_irq_wake(struct irq_data *d, unsigned int on) { struct gpio_chip *gc = irq_data_get_irq_chip_data(d); - struct intel_pinctrl *pctrl = gpiochip_to_pinctrl(gc); + struct intel_pinctrl *pctrl = gpiochip_get_data(gc); const struct intel_community *community; unsigned pin = irqd_to_hwirq(d); unsigned padno, gpp, gpp_offset; @@ -877,7 +876,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) pctrl->chip.parent = pctrl->dev; pctrl->chip.base = -1; - ret = gpiochip_add(&pctrl->chip); + ret = gpiochip_add_data(&pctrl->chip, pctrl); if (ret) { dev_err(pctrl->dev, "failed to register gpiochip\n"); return ret;