From patchwork Wed Dec 9 13:26:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58027 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp667427lbb; Wed, 9 Dec 2015 05:26:52 -0800 (PST) X-Received: by 10.66.149.229 with SMTP id ud5mr7723010pab.83.1449667611935; Wed, 09 Dec 2015 05:26:51 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wp3si12717417pab.160.2015.12.09.05.26.51; Wed, 09 Dec 2015 05:26:51 -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 S1751531AbbLIN0v (ORCPT + 4 others); Wed, 9 Dec 2015 08:26:51 -0500 Received: from mail-lb0-f173.google.com ([209.85.217.173]:33591 "EHLO mail-lb0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751310AbbLIN0u (ORCPT ); Wed, 9 Dec 2015 08:26:50 -0500 Received: by lbbkw15 with SMTP id kw15so29947415lbb.0 for ; Wed, 09 Dec 2015 05:26:49 -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=eK0cUOsO8Faxn8hAx1Z1G2ulEWZEh08F6IyBfxWpL2I=; b=b4pJVREwufByJ7gogLpiyKUzpBcsiWafTGHhvyGEJBAd4T8+XARjF8wI3Krh1z05bM UL2SN83XEvIRQsZnKfRSaS/P4j2s2N2B403Y0qqeNX5xcSZm4pzL1LOwzf7UyYVMzfrS IchpIw10FjkwFyL+hS/QlPRkTtioZViApFQgh1p+Fwmc8thUzropRXuVSxuUBrTECHeX rMa0hATPEBJZo52q1SSfnU+uUQ2OpkyrG2TTlgyleaaLxcprrXYYc1IV7FtqmpHVQKgH +LTqXhs12+JG/3QyP0LcfyjFamAqg0JdPHAUWvoIwLyAxH0Hb/fAGNIIYU/uO8XcatpY bdLQ== 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=eK0cUOsO8Faxn8hAx1Z1G2ulEWZEh08F6IyBfxWpL2I=; b=d7u4spGHLomBAZQ6GMCB2HUcHhz4v4Q8bvkB/IcdV/nKLe78A9dcsHHi0lxcLYR8/f xS72EqBwgQ7QmUl00B4NIY7rhV2L8Uy+QPHwZLv/LABDk9pk2L08Aqo59UsQ5sTY5HpS DE4IPAYUmXHc5V8zjNTyoePwNyIyP6S8Fh6vkAJIr2aEjJEnfgy+4rrNYJEgnE1bN970 M3W6tzxc748TkXE/4enhXYMpJI71eT9fyUJJzw1azPksFLLOw6t+jN7oG2xpB1Aru9DB 6+DzSabZdGFN2Sz5OQhZWYyqMM4MUrZHjYibzn6XHoctUvjnRl/yKvhcomF9Wn+RG4ua ZBMA== X-Gm-Message-State: ALoCoQnGOvu9ucJdL4qJkidqG1TmOJ2Oo8MMIcCMHcGOhfNu3H3Ig2cWAjkw29DEAEcRm28FEAGnvPstZze7zsYRCqszptnbug== X-Received: by 10.112.161.33 with SMTP id xp1mr2368186lbb.141.1449667609310; Wed, 09 Dec 2015 05:26:49 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id j204sm1398862lfd.16.2015.12.09.05.26.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:26:48 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Vivien Didelot Subject: [PATCH 071/182] gpio: ts5500: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:26:46 +0100 Message-Id: <1449667606-738-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: Vivien Didelot Signed-off-by: Linus Walleij --- drivers/gpio/gpio-ts5500.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-ts5500.c b/drivers/gpio/gpio-ts5500.c index aafe7910e030..5f945083f9d8 100644 --- a/drivers/gpio/gpio-ts5500.c +++ b/drivers/gpio/gpio-ts5500.c @@ -185,11 +185,6 @@ static const struct ts5500_dio ts5500_lcd[] = { TS5500_DIO_IN_IRQ(0x73, 7, 1), }; -static inline struct ts5500_priv *ts5500_gc_to_priv(struct gpio_chip *chip) -{ - return container_of(chip, struct ts5500_priv, gpio_chip); -} - static inline void ts5500_set_mask(u8 mask, u8 addr) { u8 val = inb(addr); @@ -206,7 +201,7 @@ static inline void ts5500_clear_mask(u8 mask, u8 addr) static int ts5500_gpio_input(struct gpio_chip *chip, unsigned offset) { - struct ts5500_priv *priv = ts5500_gc_to_priv(chip); + struct ts5500_priv *priv = gpiochip_get_data(chip); const struct ts5500_dio line = priv->pinout[offset]; unsigned long flags; @@ -225,7 +220,7 @@ static int ts5500_gpio_input(struct gpio_chip *chip, unsigned offset) static int ts5500_gpio_get(struct gpio_chip *chip, unsigned offset) { - struct ts5500_priv *priv = ts5500_gc_to_priv(chip); + struct ts5500_priv *priv = gpiochip_get_data(chip); const struct ts5500_dio line = priv->pinout[offset]; return !!(inb(line.value_addr) & line.value_mask); @@ -233,7 +228,7 @@ static int ts5500_gpio_get(struct gpio_chip *chip, unsigned offset) static int ts5500_gpio_output(struct gpio_chip *chip, unsigned offset, int val) { - struct ts5500_priv *priv = ts5500_gc_to_priv(chip); + struct ts5500_priv *priv = gpiochip_get_data(chip); const struct ts5500_dio line = priv->pinout[offset]; unsigned long flags; @@ -255,7 +250,7 @@ static int ts5500_gpio_output(struct gpio_chip *chip, unsigned offset, int val) static void ts5500_gpio_set(struct gpio_chip *chip, unsigned offset, int val) { - struct ts5500_priv *priv = ts5500_gc_to_priv(chip); + struct ts5500_priv *priv = gpiochip_get_data(chip); const struct ts5500_dio line = priv->pinout[offset]; unsigned long flags; @@ -269,7 +264,7 @@ static void ts5500_gpio_set(struct gpio_chip *chip, unsigned offset, int val) static int ts5500_gpio_to_irq(struct gpio_chip *chip, unsigned offset) { - struct ts5500_priv *priv = ts5500_gc_to_priv(chip); + struct ts5500_priv *priv = gpiochip_get_data(chip); const struct ts5500_dio *block = priv->pinout; const struct ts5500_dio line = block[offset]; @@ -414,7 +409,7 @@ static int ts5500_dio_probe(struct platform_device *pdev) break; } - ret = gpiochip_add(&priv->gpio_chip); + ret = gpiochip_add_data(&priv->gpio_chip, priv); if (ret) { dev_err(dev, "failed to register the gpio chip\n"); return ret;