From patchwork Wed Dec 9 13:30:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58050 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp669912lbb; Wed, 9 Dec 2015 05:31:10 -0800 (PST) X-Received: by 10.98.42.148 with SMTP id q142mr13263549pfq.0.1449667870396; Wed, 09 Dec 2015 05:31:10 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 28si12770236pfk.134.2015.12.09.05.31.10; Wed, 09 Dec 2015 05:31:10 -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 S1754507AbbLINbH (ORCPT + 4 others); Wed, 9 Dec 2015 08:31:07 -0500 Received: from mail-lf0-f52.google.com ([209.85.215.52]:32850 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754447AbbLINbC (ORCPT ); Wed, 9 Dec 2015 08:31:02 -0500 Received: by lfaz4 with SMTP id z4so34267056lfa.0 for ; Wed, 09 Dec 2015 05:31:01 -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=ADYlfspPp+A+VeGDC1qqTKz7zYMQt0TmFvRJib2x0Vs=; b=lm55/pUC/BrfE3E3hBfaQSNptPJdpQLmWfX7jAoMo1ET23rz5aZ8XJCB4YUXLKbruz uadB/wYhjeLQRgc4N7bdWAlA9E8zIv5dK0+ruxCISC8s0OlBS4e8nJFe24Hn/CAQHVoP 774eo3I7cv+DZ83u6t3DLk9eGr1g7L1uWTczvN+7TrYRgy4jRWof9PhlydDK9OdJqRlZ 1r/sNOZb3yhMZXR8RJrrVo+lUT87t5qjSn62kqWqYyFpocNVTrv1WFPNIiO4Kiy8j8Ac A1PuEu/Xq1Z5ka+f99XOnbS9NRfjdabRbZOwfAtchXrSjrSPlsGYKguEFmVKYak7EdqF qsiw== 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=ADYlfspPp+A+VeGDC1qqTKz7zYMQt0TmFvRJib2x0Vs=; b=IsibxWb7tkALw+Sx+XZIN8YofXHeWEbTs8o9+eLZFyM93GZzYQ4EAqYvmHsfGSaYRp YQlclGBxrPQ4ZNgnM6ALry0LaXuj4f+OOfLpyZbyzvkPGcmSFef5nsOf4nJAlMTH6t7a 1uVGE59d6KMp5c3hgWRycPKBgJTyBYV5iZTShG2Jgs56D/HmryykC/qjudWT752Hmc8q MI1iATwm00H1b+CyV+wr7DVL3KJ7xZDGwf/Z0Dvsfpc/iRmjYihC4mZcEqBaBoPDkEoj nblxUp2HMECS5lpu9hdEUf9g9HmVysxtCMnr1MTTb0403y3FkzuiNf86RSX+6XLF7fHA y/cA== X-Gm-Message-State: ALoCoQluGefx/r4XpGUYiL4rrIiNtaKKc7k/vTEmYYkJVWnDdBUCre/tDboc/XMSqFNNT1/mQIyF+C5BbB/lmX5CTT4nNENP4g== X-Received: by 10.25.137.7 with SMTP id l7mr1810069lfd.63.1449667861461; Wed, 09 Dec 2015 05:31:01 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h37sm1460440lfi.8.2015.12.09.05.31.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:31:00 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Beniamino Galvani , Carlo Caione , Antoine Tenart Subject: [PATCH 095/182] pinctrl: meson: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:30:58 +0100 Message-Id: <1449667858-2137-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: Beniamino Galvani Cc: Carlo Caione Cc: Antoine Tenart Signed-off-by: Linus Walleij --- drivers/pinctrl/meson/pinctrl-meson.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 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/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index 4b5f6829144d..50cab27c64d4 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -448,11 +448,6 @@ static const struct pinconf_ops meson_pinconf_ops = { .is_generic = true, }; -static inline struct meson_domain *to_meson_domain(struct gpio_chip *chip) -{ - return container_of(chip, struct meson_domain, chip); -} - static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio) { return pinctrl_request_gpio(chip->base + gpio); @@ -460,14 +455,14 @@ static int meson_gpio_request(struct gpio_chip *chip, unsigned gpio) static void meson_gpio_free(struct gpio_chip *chip, unsigned gpio) { - struct meson_domain *domain = to_meson_domain(chip); + struct meson_domain *domain = gpiochip_get_data(chip); pinctrl_free_gpio(domain->data->pin_base + gpio); } static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) { - struct meson_domain *domain = to_meson_domain(chip); + struct meson_domain *domain = gpiochip_get_data(chip); unsigned int reg, bit, pin; struct meson_bank *bank; int ret; @@ -485,7 +480,7 @@ static int meson_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int value) { - struct meson_domain *domain = to_meson_domain(chip); + struct meson_domain *domain = gpiochip_get_data(chip); unsigned int reg, bit, pin; struct meson_bank *bank; int ret; @@ -507,7 +502,7 @@ static int meson_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) { - struct meson_domain *domain = to_meson_domain(chip); + struct meson_domain *domain = gpiochip_get_data(chip); unsigned int reg, bit, pin; struct meson_bank *bank; int ret; @@ -524,7 +519,7 @@ static void meson_gpio_set(struct gpio_chip *chip, unsigned gpio, int value) static int meson_gpio_get(struct gpio_chip *chip, unsigned gpio) { - struct meson_domain *domain = to_meson_domain(chip); + struct meson_domain *domain = gpiochip_get_data(chip); unsigned int reg, bit, val, pin; struct meson_bank *bank; int ret; @@ -575,7 +570,7 @@ static int meson_gpiolib_register(struct meson_pinctrl *pc) domain->chip.of_node = domain->of_node; domain->chip.of_gpio_n_cells = 2; - ret = gpiochip_add(&domain->chip); + ret = gpiochip_add_data(&domain->chip, domain); if (ret) { dev_err(pc->dev, "can't add gpio chip %s\n", domain->data->name);