From patchwork Wed Dec 9 13:32:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58064 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp670976lbb; Wed, 9 Dec 2015 05:32:49 -0800 (PST) X-Received: by 10.66.150.5 with SMTP id ue5mr7889462pab.42.1449667968557; Wed, 09 Dec 2015 05:32:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc9si12758954pad.140.2015.12.09.05.32.48; Wed, 09 Dec 2015 05:32:48 -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 S1754153AbbLINcr (ORCPT + 4 others); Wed, 9 Dec 2015 08:32:47 -0500 Received: from mail-lf0-f45.google.com ([209.85.215.45]:32800 "EHLO mail-lf0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754214AbbLINcq (ORCPT ); Wed, 9 Dec 2015 08:32:46 -0500 Received: by lfaz4 with SMTP id z4so34302548lfa.0 for ; Wed, 09 Dec 2015 05:32:44 -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:mime-version:content-type :content-transfer-encoding; bh=vOlrzRwRkczu8VS5Y0DyjGx4RDzDY3YPcGA4dkATt/Q=; b=N7om2Z3GCH3EccMh4UiX8YV/m+RnFkHmsyUIZin6HvWFMcKtIxeQ6wH8wxIKHOyT0K OefWKIv5vqmExkvuXzp/DUMWCFxlRWjZT8q0QWJ94T/vMm2DADf/dY8RI++NLnM8m9M8 V+4lijLcjweFLv1+4yCaqCudHC+fFjCYvBSew/BDUMzILaJdO6STsbbkR31IuwsLn3Z8 XoHCawXQgzDOx+KuzSdRl73Nx++FN8TtfWeH/I8StMvPTiJToqMUiVntYtof+BoTCms4 1Umg7YOF/QJS3vadCkUUoeBmICkA2nhnUqyh+yuVbHlgYRDCEcxHc7pEMg5pWkKlKQ2G w+mA== 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:mime-version :content-type:content-transfer-encoding; bh=vOlrzRwRkczu8VS5Y0DyjGx4RDzDY3YPcGA4dkATt/Q=; b=DWPNE6XEH5YwvCfgYetdyHtrTLp99+B/u5oT7y2q2yJQ4XXBwsK6w33L3TYcd4GykG AvVZjz6Y4Zwodf94ZSOycxWnmfxOMw8SDIqekIECuBPd2bQczDKceHu4YZO77vBCLFfV uf9frd2/WVRu1MGZzywuwoB+8kT4MvMvyXwpBiGSdNRj+ksUHeLqm3rNSc4YU5iMrnfY RWFqWmjYkQeg6DTq43WKu0fPi9frjss1/K+dirsQSiWoeYG7L/T0Ju+xa4d6Xcgd43J6 vELQjHqab3zEaWZ/+qVa3oSxq2Un/MgL9y4apbrvLcMvRY+FIiv2QtzndKs0zLFK6/o7 Kcdg== X-Gm-Message-State: ALoCoQkhbbvWWIxEyV0vK8fuc2rG3AUYA1ocRIsP+FTOrzLNZgkkq5pu7PENDD7X5hrjMN83XKqJ5rE1AGDR7YHoq2xF4VIhhw== X-Received: by 10.25.89.70 with SMTP id n67mr2344745lfb.160.1449667964445; Wed, 09 Dec 2015 05:32:44 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id ki2sm1409998lbc.15.2015.12.09.05.32.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:32:43 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , "Ivan T. Ivanov" , =?UTF-8?q?Bj=C3=B6rn=20Andersson?= Subject: [PATCH 108/182] pinctrl: spmi: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:32:40 +0100 Message-Id: <1449667960-2914-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 MIME-Version: 1.0 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: Ivan T. Ivanov Cc: Björn Andersson Signed-off-by: Linus Walleij --- drivers/pinctrl/qcom/pinctrl-spmi-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/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c index 3e5ccc76d59c..db079b20c837 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c @@ -158,11 +158,6 @@ static const char *const pmic_gpio_functions[] = { PMIC_GPIO_FUNC_DTEST3, PMIC_GPIO_FUNC_DTEST4, }; -static inline struct pmic_gpio_state *to_gpio_state(struct gpio_chip *chip) -{ - return container_of(chip, struct pmic_gpio_state, chip); -}; - static int pmic_gpio_read(struct pmic_gpio_state *state, struct pmic_gpio_pad *pad, unsigned int addr) { @@ -495,7 +490,7 @@ static const struct pinconf_ops pmic_gpio_pinconf_ops = { static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned pin) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); @@ -506,7 +501,7 @@ static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned pin) static int pmic_gpio_direction_output(struct gpio_chip *chip, unsigned pin, int val) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, val); @@ -516,7 +511,7 @@ static int pmic_gpio_direction_output(struct gpio_chip *chip, static int pmic_gpio_get(struct gpio_chip *chip, unsigned pin) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); struct pmic_gpio_pad *pad; int ret; @@ -538,7 +533,7 @@ static int pmic_gpio_get(struct gpio_chip *chip, unsigned pin) static void pmic_gpio_set(struct gpio_chip *chip, unsigned pin, int value) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, value); @@ -561,7 +556,7 @@ static int pmic_gpio_of_xlate(struct gpio_chip *chip, static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned pin) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); struct pmic_gpio_pad *pad; pad = state->ctrl->desc->pins[pin].drv_data; @@ -571,7 +566,7 @@ static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned pin) static void pmic_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct pmic_gpio_state *state = to_gpio_state(chip); + struct pmic_gpio_state *state = gpiochip_get_data(chip); unsigned i; for (i = 0; i < chip->ngpio; i++) { @@ -771,7 +766,7 @@ static int pmic_gpio_probe(struct platform_device *pdev) if (IS_ERR(state->ctrl)) return PTR_ERR(state->ctrl); - ret = gpiochip_add(&state->chip); + ret = gpiochip_add_data(&state->chip, state); if (ret) { dev_err(state->dev, "can't add gpio chip\n"); goto err_chip;