From patchwork Wed Dec 9 13:23:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58019 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665635lbb; Wed, 9 Dec 2015 05:23:30 -0800 (PST) X-Received: by 10.66.122.72 with SMTP id lq8mr7824069pab.1.1449667410659; Wed, 09 Dec 2015 05:23:30 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc7si12732909pab.144.2015.12.09.05.23.30; Wed, 09 Dec 2015 05:23:30 -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 S1754136AbbLINX2 (ORCPT + 4 others); Wed, 9 Dec 2015 08:23:28 -0500 Received: from mail-lf0-f46.google.com ([209.85.215.46]:35932 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751585AbbLINX1 (ORCPT ); Wed, 9 Dec 2015 08:23:27 -0500 Received: by lfs39 with SMTP id 39so34275712lfs.3 for ; Wed, 09 Dec 2015 05:23:25 -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=yih8+tXTpjJ6WQlUymgW+jH2L/3iIxk5+O0qMTg+XGs=; b=h8ta7LY5tNpfELAG80YTdvG9ZjPSL4rcpDohXzz1W5POg5kMxJQRAQRcTrq105T8G4 +je3LHdo3rePenXJK+go9cDuNQqt6rtHIi/oBNPKPdokx56tpsh4nyJJ6kvsTrSyx1fL w1MNY3iphTYjdlTMiJTe1TdaQdhrNRY/cYqczaFfE/IUlJ6nwC+I3IsrLQxEN8Fh+BXq DWTxCnfFjsZUXD7L0ygp5M+wwtBViqzcUJCreuGNFucZBMxhXTtaMQpbliaYlWQNL4Zp UB8m2QGhGiridAsK9Ya3pDL+8+Ed9qyC0bbLMmQJdTmQtzfXu/ROZUxyqBpykuulufLO 8IUA== 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=yih8+tXTpjJ6WQlUymgW+jH2L/3iIxk5+O0qMTg+XGs=; b=fUkgf5ZdWpSFnJlJU5fNa7snc9rL8YWzlYiscQ7nket76Wxde72ckQfW4A1jDPEijg NXPB2RPRKXTmecFPFU48gcZ10NPSLw9HWow4rv/YtSPZ3yCoiyOGhzzdj9S8o6lfUP+n dEBp2aWei0i1CVn2233e54DOf38GE3jXAQPvN5+VxLyYfRvtp4vo4iLsUsP2CWY1psTe OCmfs6/9tt6ShgqcZ3SuI5RXp4v5s0I4G5sPRJ3X7e9xTeN7SCDdz7qIVxOEOlF5+J7w CteBL3afMlzdyS7F45+7T2frUUdPn/J3iyX5wwDXX5zXj8BPf7puNQanEAJ/W8YEtYZr m5Rg== X-Gm-Message-State: ALoCoQnWtphjwUev8qgNGfRgc6S35IdBmfQVVhhmbF+XKlmz41Vz9DHJqrj0gF2LzZ8SRnnBdjDdi08el+cYriAr24eMGzLxWQ== X-Received: by 10.25.152.133 with SMTP id a127mr2241457lfe.152.1449667405778; Wed, 09 Dec 2015 05:23:25 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id of8sm1410658lbb.7.2015.12.09.05.23.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:23:25 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Alexander Shiyan Subject: [PATCH 064/182] gpio: syscon: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:23:22 +0100 Message-Id: <1449667402-349-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: Alexander Shiyan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-syscon.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/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c index cd6afee11f84..15efe7119efb 100644 --- a/drivers/gpio/gpio-syscon.c +++ b/drivers/gpio/gpio-syscon.c @@ -59,14 +59,9 @@ struct syscon_gpio_priv { u32 dir_reg_offset; }; -static inline struct syscon_gpio_priv *to_syscon_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct syscon_gpio_priv, chip); -} - static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct syscon_gpio_priv *priv = to_syscon_gpio(chip); + struct syscon_gpio_priv *priv = gpiochip_get_data(chip); unsigned int val, offs; int ret; @@ -82,7 +77,7 @@ static int syscon_gpio_get(struct gpio_chip *chip, unsigned offset) static void syscon_gpio_set(struct gpio_chip *chip, unsigned offset, int val) { - struct syscon_gpio_priv *priv = to_syscon_gpio(chip); + struct syscon_gpio_priv *priv = gpiochip_get_data(chip); unsigned int offs; offs = priv->dreg_offset + priv->data->dat_bit_offset + offset; @@ -95,7 +90,7 @@ static void syscon_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static int syscon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) { - struct syscon_gpio_priv *priv = to_syscon_gpio(chip); + struct syscon_gpio_priv *priv = gpiochip_get_data(chip); if (priv->data->flags & GPIO_SYSCON_FEAT_DIR) { unsigned int offs; @@ -113,7 +108,7 @@ static int syscon_gpio_dir_in(struct gpio_chip *chip, unsigned offset) static int syscon_gpio_dir_out(struct gpio_chip *chip, unsigned offset, int val) { - struct syscon_gpio_priv *priv = to_syscon_gpio(chip); + struct syscon_gpio_priv *priv = gpiochip_get_data(chip); if (priv->data->flags & GPIO_SYSCON_FEAT_DIR) { unsigned int offs; @@ -144,7 +139,7 @@ static const struct syscon_gpio_data clps711x_mctrl_gpio = { static void keystone_gpio_set(struct gpio_chip *chip, unsigned offset, int val) { - struct syscon_gpio_priv *priv = to_syscon_gpio(chip); + struct syscon_gpio_priv *priv = gpiochip_get_data(chip); unsigned int offs; int ret; @@ -239,7 +234,7 @@ static int syscon_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, priv); - return gpiochip_add(&priv->chip); + return gpiochip_add_data(&priv->chip, priv); } static int syscon_gpio_remove(struct platform_device *pdev)