From patchwork Wed Dec 9 13:32:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58065 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp671054lbb; Wed, 9 Dec 2015 05:32:57 -0800 (PST) X-Received: by 10.66.227.129 with SMTP id sa1mr7953641pac.132.1449667977432; Wed, 09 Dec 2015 05:32:57 -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.32.57; Wed, 09 Dec 2015 05:32:57 -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 S1754580AbbLINcz (ORCPT + 4 others); Wed, 9 Dec 2015 08:32:55 -0500 Received: from mail-lf0-f54.google.com ([209.85.215.54]:35944 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754496AbbLINcy (ORCPT ); Wed, 9 Dec 2015 08:32:54 -0500 Received: by lfs39 with SMTP id 39so34459796lfs.3 for ; Wed, 09 Dec 2015 05:32: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:mime-version:content-type :content-transfer-encoding; bh=yYSfZL15wKK7/toOeiY777KxyrwOPzE3o93PSLnX0PM=; b=ApNLgiAEx1GYd3Lt9zqiyGHWdMCT88PYDDxS0ttQQJtFsSKj4+78QMKYKwwyjxT3wZ +Uqxe3Iix3k29+hjXFxaPBjC69GG73EFzl9KuNCCdHeMoiiGghJ3Xt/wr068xqkzXgxH LGIwZgpM8bJEjW/g+mLX5EHIH9W4XJkcritfFuZNF3lHd3d+UPNJqWgOZ341X8y9PqjP UyBEYmcDUuQSy+OOCLc3SSkWqyo9tlYj0NyBvHLPnIVV0Ug7O5ukuNCJJigI9KZlqdI7 dyIUVVm5VX2peZfV1puNY1K8PDanPAvTkwCJejIUfEqphMlwyPtO1NkBW4MBWppFF1XB Tiig== 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=yYSfZL15wKK7/toOeiY777KxyrwOPzE3o93PSLnX0PM=; b=MyiR1LrKW2J6KPypPhnEXJqEXssp1WENr2Aonqo62VKDytzq/9kNeu+odpFhPGiP6o ZebOt9AK+mqXQoNCRgxcn9iE2IAutBsg5EEkYuUTfBfyFRFStzG1GUweoyW+syTRtewl +rieXQZx6WQD9v86AnhLh4aOinKiMXQoRMwaYNG3TSGQCnviBXhQmxMl/A+6qmgLQ1Al OKacRARwqxGlpkvBYvjGaQHiOWnFoQVe2EDi6W6CeIPXRiAPSYTyGdD0y9wXKCFhdEGD DjXcKUxvQXXpXI26XmjkyjHWiBTuwB/D00GR8fspUW4v/JFLvntZfXrKUXZw6OWyGAOf 78hg== X-Gm-Message-State: ALoCoQlhumU1T6gKd5sRfFNP/sRmYV2WUFzg/28Ub07zPGbJIDphXYSsmkQCk0F7QyIhBR+95MhEcv+jwLqXw9CDnojXe5F7YQ== X-Received: by 10.25.145.81 with SMTP id t78mr2289824lfd.86.1449667973243; Wed, 09 Dec 2015 05:32:53 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id zm10sm1427251lbb.49.2015.12.09.05.32.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:32:52 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , =?UTF-8?q?Bj=C3=B6rn=20Andersson?= , "Ivan T. Ivanov" Subject: [PATCH 109/182] pinctrl: spmi-mpp: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:32:49 +0100 Message-Id: <1449667969-2961-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: Björn Andersson Cc: Ivan T. Ivanov Signed-off-by: Linus Walleij --- drivers/pinctrl/qcom/pinctrl-spmi-mpp.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-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c index 69c14ba177d0..0f3a7fafaca3 100644 --- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c +++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c @@ -178,11 +178,6 @@ static const char *const pmic_mpp_functions[] = { "digital", "analog", "sink" }; -static inline struct pmic_mpp_state *to_mpp_state(struct gpio_chip *chip) -{ - return container_of(chip, struct pmic_mpp_state, chip); -}; - static int pmic_mpp_read(struct pmic_mpp_state *state, struct pmic_mpp_pad *pad, unsigned int addr) { @@ -556,7 +551,7 @@ static const struct pinconf_ops pmic_mpp_pinconf_ops = { static int pmic_mpp_direction_input(struct gpio_chip *chip, unsigned pin) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); @@ -567,7 +562,7 @@ static int pmic_mpp_direction_input(struct gpio_chip *chip, unsigned pin) static int pmic_mpp_direction_output(struct gpio_chip *chip, unsigned pin, int val) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, val); @@ -577,7 +572,7 @@ static int pmic_mpp_direction_output(struct gpio_chip *chip, static int pmic_mpp_get(struct gpio_chip *chip, unsigned pin) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); struct pmic_mpp_pad *pad; int ret; @@ -596,7 +591,7 @@ static int pmic_mpp_get(struct gpio_chip *chip, unsigned pin) static void pmic_mpp_set(struct gpio_chip *chip, unsigned pin, int value) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned long config; config = pinconf_to_config_packed(PIN_CONFIG_OUTPUT, value); @@ -619,7 +614,7 @@ static int pmic_mpp_of_xlate(struct gpio_chip *chip, static int pmic_mpp_to_irq(struct gpio_chip *chip, unsigned pin) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); struct pmic_mpp_pad *pad; pad = state->ctrl->desc->pins[pin].drv_data; @@ -629,7 +624,7 @@ static int pmic_mpp_to_irq(struct gpio_chip *chip, unsigned pin) static void pmic_mpp_dbg_show(struct seq_file *s, struct gpio_chip *chip) { - struct pmic_mpp_state *state = to_mpp_state(chip); + struct pmic_mpp_state *state = gpiochip_get_data(chip); unsigned i; for (i = 0; i < chip->ngpio; i++) { @@ -873,7 +868,7 @@ static int pmic_mpp_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;