From patchwork Wed Dec 9 13:32:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58061 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp670697lbb; Wed, 9 Dec 2015 05:32:24 -0800 (PST) X-Received: by 10.67.5.164 with SMTP id cn4mr7647579pad.141.1449667943929; Wed, 09 Dec 2015 05:32:23 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f18si12793619pfj.115.2015.12.09.05.32.23; Wed, 09 Dec 2015 05:32:23 -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 S1754265AbbLINcX (ORCPT + 4 others); Wed, 9 Dec 2015 08:32:23 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:33901 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754172AbbLINcW (ORCPT ); Wed, 9 Dec 2015 08:32:22 -0500 Received: by lffu14 with SMTP id u14so34313913lff.1 for ; Wed, 09 Dec 2015 05:32:21 -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=vw01Eb3Zt1pToPOSlvuNpHUBAQoIGmXvvvOUXd4iJNE=; b=ZY8Q9BYYvZR+LEKihaCL66flkh4+eg05u/oNgGS9OrXurGFQK1E7JGZmKTd5jKm9RP 1qqV3NkLGH/1++JoHHbd565huVguRuBs3YhZI0g8936CaecpotTDTgyDKD82zT5qsqUa jVQAI4zpMqO/2QHFgA5MRwzhkSehsZ+IeKpLZJUghRSv5tn11h9pMb4IRZ23fXoBdz5o yBZyHURIgpf1NaZ6tcfI27HGoK12CjcwJa2MK3660cz2SjBg1EA4ckCck3c9xKj5n9H9 Gzi4DofYvDdbzTc6seeCpeDChcLfBC8pmo81bcvlWVs4ZAuafClbMqIa15TJG+LI/1Nu YY9g== 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=vw01Eb3Zt1pToPOSlvuNpHUBAQoIGmXvvvOUXd4iJNE=; b=AwVUiZFo5/sYxFnS/ufdC6qJ8OZE0ifvdnHTc7OaigbLPUpzcZ4UVnmo/HsVh6I8WD ziO5/q0VhuPB7q0zVD+xGoIh8am3eogmiR0gkjY8a3t+CU3JnMCvJaTFswy9yxDpXt4K Z8BFpp6ZmFDVPfjJC+2AAgtQXvJ5rSuYyk5KBBZgIvn3jhoKciud9GNef9AvzRMDOWDi G80oobTuOGEGXRFPgVBtLGpky8pyo8Js5Q8GiKi8dLOEts50uIi10UG04O+wFzitSBJq g/lmC2P48NhW3ShsCl3L9R7wVc2wQJIIs6+YZwXhvFuiNJKILMupVfFGrcOU9Kcb8yPM VVBA== X-Gm-Message-State: ALoCoQnZ+OUYHlwHCVWvpJYCjKQipX2QaerOMkeXsd+Zs7U6tbtiPrKc6qMmTmyAx5gOV2uxX1k+kq9w3Y1Xk8sWX11vG6clIg== X-Received: by 10.25.135.133 with SMTP id j127mr1830056lfd.73.1449667941408; Wed, 09 Dec 2015 05:32:21 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id sv10sm1401434lbb.46.2015.12.09.05.32.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:32:20 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Heiko Stuebner Subject: [PATCH 105/182] pinctrl: rockchip: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:32:18 +0100 Message-Id: <1449667938-2753-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: Heiko Stuebner Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-rockchip.c | 15 +++++---------- 1 file changed, 5 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/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 2b88a40f61d3..56b8ce2a3df9 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -224,11 +224,6 @@ static struct regmap_config rockchip_regmap_config = { .reg_stride = 4, }; -static inline struct rockchip_pin_bank *gc_to_pin_bank(struct gpio_chip *gc) -{ - return container_of(gc, struct rockchip_pin_bank, gpio_chip); -} - static const inline struct rockchip_pin_group *pinctrl_name_to_group( const struct rockchip_pinctrl *info, const char *name) @@ -939,7 +934,7 @@ static int _rockchip_pmx_gpio_set_direction(struct gpio_chip *chip, unsigned long flags; u32 data; - bank = gc_to_pin_bank(chip); + bank = gpiochip_get_data(chip); ret = rockchip_set_mux(bank, pin, RK_FUNC_GPIO); if (ret < 0) @@ -1376,7 +1371,7 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct rockchip_pin_bank *bank = gc_to_pin_bank(gc); + struct rockchip_pin_bank *bank = gpiochip_get_data(gc); void __iomem *reg = bank->reg_base + GPIO_SWPORT_DR; unsigned long flags; u32 data; @@ -1400,7 +1395,7 @@ static void rockchip_gpio_set(struct gpio_chip *gc, unsigned offset, int value) */ static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct rockchip_pin_bank *bank = gc_to_pin_bank(gc); + struct rockchip_pin_bank *bank = gpiochip_get_data(gc); u32 data; clk_enable(bank->clk); @@ -1439,7 +1434,7 @@ static int rockchip_gpio_direction_output(struct gpio_chip *gc, */ static int rockchip_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct rockchip_pin_bank *bank = gc_to_pin_bank(gc); + struct rockchip_pin_bank *bank = gpiochip_get_data(gc); unsigned int virq; if (!bank->domain) @@ -1758,7 +1753,7 @@ static int rockchip_gpiolib_register(struct platform_device *pdev, gc->of_node = bank->of_node; gc->label = bank->name; - ret = gpiochip_add(gc); + ret = gpiochip_add_data(gc, bank); if (ret) { dev_err(&pdev->dev, "failed to register gpio_chip %s, error code: %d\n", gc->label, ret);