From patchwork Wed Dec 9 13:28:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58038 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp668231lbb; Wed, 9 Dec 2015 05:28:16 -0800 (PST) X-Received: by 10.66.122.105 with SMTP id lr9mr8021883pab.8.1449667695951; Wed, 09 Dec 2015 05:28:15 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ny6si12718088pab.215.2015.12.09.05.28.15; Wed, 09 Dec 2015 05:28:15 -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 S1753998AbbLIN2P (ORCPT + 4 others); Wed, 9 Dec 2015 08:28:15 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:34722 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbbLIN2O (ORCPT ); Wed, 9 Dec 2015 08:28:14 -0500 Received: by lffu14 with SMTP id u14so34233611lff.1 for ; Wed, 09 Dec 2015 05:28:13 -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=4HIwi5/2p1XLGhDi5D+ie6g83KmCeD/2X7mpfJ4Oakg=; b=AX5kBdJ1W9LAElgfx74dUrbBUin5iiuHX6mS8hGypuv2XfwpYLA4B4+2LBlJ7qgIHN u3W688Sv+KTBwHG67DYaNvl2HELHnb0rMAvm1k+2cklP9VhiXS5FvJ0L8bwJQjwSnDYT I/AFHur2J2l4GUId5bi5Imw8dQd4a/JVikL998ao22vnpjdmPNMQXe2EkliEfwQC7Zil oFqhaiZxUVCoSgzby1+qLXYBPktLuXsgHOTHH2FR8Yc277+VbmDXJQFS7RgKeByW+mv5 5UIZm74IlRyxXtkkkK6m9CK37mMo+A0BegSKiwATKdPndiXhudiXgn3FrH//IagbTUcR zJcw== 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=4HIwi5/2p1XLGhDi5D+ie6g83KmCeD/2X7mpfJ4Oakg=; b=eig5cCsB13zp3Dz4sqih8bCzDwxWczxveH0MihlL9npZiF1MDxA/dos3mVEAsUmH9v skQYptbcOcgw8lOTt9F0bL40XFj/H+R9XYjgNmmcr6aINuwLHNGmFQY/9xs8yAgGN6du 8XOKkNatEO8XupjeCmOQ6XEJPml5L3Dz7PV1dsgv31zkk/i85baURQMj5w2WCSzPQh2o Rm4/r7H7ZQalh/iGxu2xjBqo9v/HwwbmzmOVjcEGwvyIyWZozZEuMQrDM+R7E6Hm7fhx GW3utuy79KohU1MVATbiNPOgp7zPttj8ylEb9eR9baUBZERlug/ZiPo9h/0mnGJjnxfv uPuw== X-Gm-Message-State: ALoCoQmcJRDsYTuEUyjNahIxKx8v7v38W8UDUT1vh/PAtP9yfNALi/VGRUQslbkfyVEXOTbzpciclASZQ/xVOVJa3ykpydPxNg== X-Received: by 10.25.205.135 with SMTP id d129mr2405359lfg.32.1449667693562; Wed, 09 Dec 2015 05:28:13 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id 88sm1442092lfq.3.2015.12.09.05.28.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:28:12 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Feng Kan Subject: [PATCH 082/182] gpio: xgene: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:28:08 +0100 Message-Id: <1449667688-1317-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: Feng Kan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-xgene.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-xgene.c b/drivers/gpio/gpio-xgene.c index b8ceb71885f6..592e9cdf9c53 100644 --- a/drivers/gpio/gpio-xgene.c +++ b/drivers/gpio/gpio-xgene.c @@ -47,14 +47,9 @@ struct xgene_gpio { #endif }; -static inline struct xgene_gpio *to_xgene_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct xgene_gpio, chip); -} - static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset) { - struct xgene_gpio *chip = to_xgene_gpio(gc); + struct xgene_gpio *chip = gpiochip_get_data(gc); unsigned long bank_offset; u32 bit_offset; @@ -65,7 +60,7 @@ static int xgene_gpio_get(struct gpio_chip *gc, unsigned int offset) static void __xgene_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) { - struct xgene_gpio *chip = to_xgene_gpio(gc); + struct xgene_gpio *chip = gpiochip_get_data(gc); unsigned long bank_offset; u32 setval, bit_offset; @@ -82,7 +77,7 @@ static void __xgene_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) static void xgene_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) { - struct xgene_gpio *chip = to_xgene_gpio(gc); + struct xgene_gpio *chip = gpiochip_get_data(gc); unsigned long flags; spin_lock_irqsave(&chip->lock, flags); @@ -92,7 +87,7 @@ static void xgene_gpio_set(struct gpio_chip *gc, unsigned int offset, int val) static int xgene_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) { - struct xgene_gpio *chip = to_xgene_gpio(gc); + struct xgene_gpio *chip = gpiochip_get_data(gc); unsigned long flags, bank_offset; u32 dirval, bit_offset; @@ -113,7 +108,7 @@ static int xgene_gpio_dir_in(struct gpio_chip *gc, unsigned int offset) static int xgene_gpio_dir_out(struct gpio_chip *gc, unsigned int offset, int val) { - struct xgene_gpio *chip = to_xgene_gpio(gc); + struct xgene_gpio *chip = gpiochip_get_data(gc); unsigned long flags, bank_offset; u32 dirval, bit_offset; @@ -198,7 +193,7 @@ static int xgene_gpio_probe(struct platform_device *pdev) platform_set_drvdata(pdev, gpio); - err = gpiochip_add(&gpio->chip); + err = gpiochip_add_data(&gpio->chip, gpio); if (err) { dev_err(&pdev->dev, "failed to register gpiochip.\n");