From patchwork Wed Dec 9 13:33:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58070 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp671407lbb; Wed, 9 Dec 2015 05:33:32 -0800 (PST) X-Received: by 10.66.65.203 with SMTP id z11mr7937647pas.152.1449668012648; Wed, 09 Dec 2015 05:33:32 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si12782315pfa.123.2015.12.09.05.33.32; Wed, 09 Dec 2015 05:33: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 S1754475AbbLINdc (ORCPT + 4 others); Wed, 9 Dec 2015 08:33:32 -0500 Received: from mail-lb0-f173.google.com ([209.85.217.173]:33919 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754451AbbLINdb (ORCPT ); Wed, 9 Dec 2015 08:33:31 -0500 Received: by lbbcs9 with SMTP id cs9so29980180lbb.1 for ; Wed, 09 Dec 2015 05:33: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=j/r2emJMyJm8t/LJN46b73Bg3owgHsEmsk5pf8/oe14=; b=Bomf/ktDfruIwpwgvOGbNxMXx0UcD794ii3Cgd5LruMhMl6PkUjQchVzoI9co7/+hL gKVz3PF4MKTAc9W3dVn/AR827jnHrbuueDP0SfF7WxcTbMFbNQtzIFkNgMm/iTs5WVu6 nbcbd7QKtlBYkTzIqV9tNqjN8ce9/5ROWCqy3vzhhQ8QPK9WQfMBFLYp6rqq3QAcb7a6 RfHxzWTwEECL62Q+ZOvQkv9MYzkwVgj1mvf+hYxhRtzNCLnrNwHMEEi8t/BWGa4zkz4L sbIGFQ7Ff3z3l++9BSMSPJk5DMakB0B95vKe9mAvcK6MEYFsC0pNoNi3KC8bn4mBdY9A nx7Q== 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=j/r2emJMyJm8t/LJN46b73Bg3owgHsEmsk5pf8/oe14=; b=Dl47MoI0L/fIQQt0Q8qqnpqjElNYvxm5nwJs5PTl0Cc5IM2ut2a+tR5KatYxOJSb5H U+FyZBw7T9J1zuytuPGMYJyYU+gO1LJRJfl6+o81tP/Ip65EMuwQQ5Cilgmvf1JArZhO oyYfILALk7Eilmd8NMp8qy7bjECbmr+UQxdSpqU9WkNgAIrVaM+9X3a+Ee+MZhku11sl YU/wXPKxQx0HXsKPEnx8EtrNtiEAImjZDhPgKLnlZ8oDmmguIQcApOhe7yeA2z8NAx3R VSBM7i0J26Bo2H69dKrVP+qeItHycyqZP+miPZhzSd8D3iLCyjN+XxZX8s+HBw3bgbeo uuCg== X-Gm-Message-State: ALoCoQljzNqGh9vgnMCUHEkIHFeSEYY6WepBnK/Yd7fFODQRlVCmWtxqF9Wb6gsviiUO1jt0CfrpnbFqHoRsq1uuuZ79jc+WFw== X-Received: by 10.112.170.167 with SMTP id an7mr2317614lbc.37.1449668009764; Wed, 09 Dec 2015 05:33:29 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id p69sm1416952lfe.42.2015.12.09.05.33.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:33:29 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Geert Uytterhoeven , Laurent Pinchart Subject: [PATCH 114/182] pinctrl: sh-pfc: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:33:26 +0100 Message-Id: <1449668006-3199-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: Geert Uytterhoeven Cc: Laurent Pinchart Signed-off-by: Linus Walleij --- drivers/pinctrl/sh-pfc/gpio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 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/sh-pfc/gpio.c b/drivers/pinctrl/sh-pfc/gpio.c index cdb2460a7b00..a6681b8b17c3 100644 --- a/drivers/pinctrl/sh-pfc/gpio.c +++ b/drivers/pinctrl/sh-pfc/gpio.c @@ -38,14 +38,10 @@ struct sh_pfc_chip { struct sh_pfc_gpio_pin *pins; }; -static struct sh_pfc_chip *gpio_to_pfc_chip(struct gpio_chip *gc) -{ - return container_of(gc, struct sh_pfc_chip, gpio_chip); -} - static struct sh_pfc *gpio_to_pfc(struct gpio_chip *gc) { - return gpio_to_pfc_chip(gc)->pfc; + struct sh_pfc_chip *chip = gpiochip_get_data(gc); + return chip->pfc; } static void gpio_get_data_reg(struct sh_pfc_chip *chip, unsigned int offset, @@ -178,14 +174,14 @@ static int gpio_pin_direction_input(struct gpio_chip *gc, unsigned offset) static int gpio_pin_direction_output(struct gpio_chip *gc, unsigned offset, int value) { - gpio_pin_set_value(gpio_to_pfc_chip(gc), offset, value); + gpio_pin_set_value(gpiochip_get_data(gc), offset, value); return pinctrl_gpio_direction_output(offset); } static int gpio_pin_get(struct gpio_chip *gc, unsigned offset) { - struct sh_pfc_chip *chip = gpio_to_pfc_chip(gc); + struct sh_pfc_chip *chip = gpiochip_get_data(gc); struct sh_pfc_gpio_data_reg *reg; unsigned int bit; unsigned int pos; @@ -199,7 +195,7 @@ static int gpio_pin_get(struct gpio_chip *gc, unsigned offset) static void gpio_pin_set(struct gpio_chip *gc, unsigned offset, int value) { - gpio_pin_set_value(gpio_to_pfc_chip(gc), offset, value); + gpio_pin_set_value(gpiochip_get_data(gc), offset, value); } static int gpio_pin_to_irq(struct gpio_chip *gc, unsigned offset) @@ -322,7 +318,7 @@ sh_pfc_add_gpiochip(struct sh_pfc *pfc, int(*setup)(struct sh_pfc_chip *), if (ret < 0) return ERR_PTR(ret); - ret = gpiochip_add(&chip->gpio_chip); + ret = gpiochip_add_data(&chip->gpio_chip, chip); if (unlikely(ret < 0)) return ERR_PTR(ret);