From patchwork Thu Dec 10 18:03:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58236 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp654816lbb; Thu, 10 Dec 2015 10:03:32 -0800 (PST) X-Received: by 10.66.158.169 with SMTP id wv9mr18364732pab.138.1449770612287; Thu, 10 Dec 2015 10:03:32 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si21595238pat.36.2015.12.10.10.03.32; Thu, 10 Dec 2015 10:03:32 -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 S1752903AbbLJSDb (ORCPT + 4 others); Thu, 10 Dec 2015 13:03:31 -0500 Received: from mail-lf0-f51.google.com ([209.85.215.51]:36048 "EHLO mail-lf0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752267AbbLJSDa (ORCPT ); Thu, 10 Dec 2015 13:03:30 -0500 Received: by lfed137 with SMTP id d137so11731841lfe.3 for ; Thu, 10 Dec 2015 10:03:29 -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=k9K/0ziV8c+IPbUBijasJDhrp0X1ds0+EfphuemXwBk=; b=ZJDByqnijWyM7WE7e1/GJI0/KgZuzoLIH+y6L0D/VOqNiekfi10rGSIj8jq66Pbcj3 l9Ao5uDkfX0ngjllFOwlWVpepCh3HB5VIi5ljIeBDnEnnJAwaC5Gp7DKXE7gQbZV8mTy NdymF8AWeHw1WIYoDrcds+EK7ETf4REOR52VUfjgsxBZnm6rEgxBmmqNe/cJxvLnEOYg xyJfgis1PK0QG8AlYlM+tksArds1cTmD/Ir/sNqh8MoYXbKZbAGZXZtIBeVfyKUPgeRQ iAMin6Owh4p5dRPAq9yQHAK5r8+oETiLzljkOz5kgc71rOrJRsb3u3yw/pEBjvnOxL95 8qyA== 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=k9K/0ziV8c+IPbUBijasJDhrp0X1ds0+EfphuemXwBk=; b=jCtKJ1iyw1Sbs3LFM4aJZkZhqae78x7m23R84dnD7PhVr1ug4eZ0wyLgqTV3VmIamC SU3YRSC4Pedoe3sLONzOlL2CLPWDVtp5MZrWzSrqvw0vfOG126Lj2rvf2H3YRB2PxIPX Vl3dZaAB+yvYqDVQho/nPPIZM3E6DFle8x9iCjKiAEGSxpcic0yy7O3hPLP+whasrUH3 GNUJfT+re5kvqPZP3hwWfagtIJrJqnjo62vvDnRlWlZYpMq6ISlbwFgpCmUGqgYsbldK bQ98LEfiTRm28Ox+BNVfnbMY/9s28/SZW2ig5lA4Qa4h+pQVI9oeEy1ezw85ylh1G9c7 pMdw== X-Gm-Message-State: ALoCoQkYcwzCIhDZq4dX9XpUSsz+JWa2NHonHlShL8b6DAqTWmyXCbUi60qs68+HXgg/T2DmRRRvf912fcDI9iSjDL5NCgdDmQ== X-Received: by 10.25.147.209 with SMTP id v200mr5864192lfd.102.1449770609140; Thu, 10 Dec 2015 10:03:29 -0800 (PST) Received: from localhost.localdomain.localdomain (c-297471d5.01-192-6c756e10.cust.bredbandsbolaget.se. [213.113.116.41]) by smtp.gmail.com with ESMTPSA id l81sm2522469lfb.40.2015.12.10.10.03.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Dec 2015 10:03:28 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Alexandre Courbot Cc: Linus Walleij , Yendapally Reddy Dhananjaya Reddy Subject: [PATCH] pinctrl: nsp-gpio: use gpiochip data pointer Date: Thu, 10 Dec 2015 19:03:24 +0100 Message-Id: <1449770604-15734-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: Yendapally Reddy Dhananjaya Reddy Signed-off-by: Linus Walleij --- drivers/pinctrl/bcm/pinctrl-nsp-gpio.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/pinctrl/bcm/pinctrl-nsp-gpio.c b/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c index bb7891e786e3..59192ad10d98 100644 --- a/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c +++ b/drivers/pinctrl/bcm/pinctrl-nsp-gpio.c @@ -18,7 +18,7 @@ * through the interaction with the NSP IOMUX controller. */ -#include +#include #include #include #include @@ -81,11 +81,6 @@ enum base_type { IO_CTRL }; -static inline struct nsp_gpio *to_nsp_gpio(struct gpio_chip *gc) -{ - return container_of(gc, struct nsp_gpio, gc); -} - /* * Mapping from PINCONF pins to GPIO pins is 1-to-1 */ @@ -297,7 +292,7 @@ static void nsp_gpio_free(struct gpio_chip *gc, unsigned offset) static int nsp_gpio_direction_input(struct gpio_chip *gc, unsigned gpio) { - struct nsp_gpio *chip = to_nsp_gpio(gc); + struct nsp_gpio *chip = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&chip->lock, flags); @@ -311,7 +306,7 @@ static int nsp_gpio_direction_input(struct gpio_chip *gc, unsigned gpio) static int nsp_gpio_direction_output(struct gpio_chip *gc, unsigned gpio, int val) { - struct nsp_gpio *chip = to_nsp_gpio(gc); + struct nsp_gpio *chip = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&chip->lock, flags); @@ -325,7 +320,7 @@ static int nsp_gpio_direction_output(struct gpio_chip *gc, unsigned gpio, static void nsp_gpio_set(struct gpio_chip *gc, unsigned gpio, int val) { - struct nsp_gpio *chip = to_nsp_gpio(gc); + struct nsp_gpio *chip = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&chip->lock, flags); @@ -337,14 +332,14 @@ static void nsp_gpio_set(struct gpio_chip *gc, unsigned gpio, int val) static int nsp_gpio_get(struct gpio_chip *gc, unsigned gpio) { - struct nsp_gpio *chip = to_nsp_gpio(gc); + struct nsp_gpio *chip = gpiochip_get_data(gc); return !!(readl(chip->base + NSP_GPIO_DATA_IN) & BIT(gpio)); } static int nsp_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct nsp_gpio *chip = to_nsp_gpio(gc); + struct nsp_gpio *chip = gpiochip_get_data(gc); return irq_linear_revmap(chip->irq_domain, offset); } @@ -714,7 +709,7 @@ static int nsp_gpio_probe(struct platform_device *pdev) writel(val, (chip->base + NSP_CHIP_A_INT_MASK)); } - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, chip); if (ret < 0) { dev_err(dev, "unable to add GPIO chip\n"); return ret;