From patchwork Wed Dec 9 13:22:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58014 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665360lbb; Wed, 9 Dec 2015 05:23:02 -0800 (PST) X-Received: by 10.98.8.211 with SMTP id 80mr13098193pfi.136.1449667382234; Wed, 09 Dec 2015 05:23:02 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u66si12736399pfa.243.2015.12.09.05.23.01; Wed, 09 Dec 2015 05:23:02 -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 S1753317AbbLINWz (ORCPT + 4 others); Wed, 9 Dec 2015 08:22:55 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:36715 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753156AbbLINWt (ORCPT ); Wed, 9 Dec 2015 08:22:49 -0500 Received: by lbblt2 with SMTP id lt2so29984048lbb.3 for ; Wed, 09 Dec 2015 05:22:48 -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=qdhgPt7SlWllMpm091x4+f1pV7GDSE1x00ERdn4olW4=; b=a2bBPNLMu3crzXlbmocTAKn2inxeCJpbP0/+G31xGyZWS9/eTmAynLAb2dIcNfDhLP YHzpsmxVWVbEfOE0xLTR8Bk51/pTaepDfkDitWG0jGJl5jrsAbVwwmzEfIE0Uuny+1OW iaEfS+ws+3anGXpw+kOeF93vsHt/kUNP79B9kv9lCSIMarTQU2GTlGmC+V8LU5e7l85y Ilalr+H77Wp9b4KKiN+bmYUHBHAVPoxbZAgP01NIMGPhF4EMtEY+V7KYK4T7FXPzC8LB bZyTdjET8Bo35eReiqmp1+1/c8W7x0JY9AFgx7t7MWhvVPttUHcBVUiYQZJtHy4eeTfL kK0Q== 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=qdhgPt7SlWllMpm091x4+f1pV7GDSE1x00ERdn4olW4=; b=m77uK+TPIRDxIDA4+BPkPxcU5kCjrWeNUHoZ3+YezvpqrH/RwmnyixVke2UDu/4TXv riAsQM4a5o+F83ymQapAAhu139GQ01Gr3WD9ZqWrxo5Kk0eWsQsifoFUZzcsg6d5z/3o 0fUaQmahRF9ZdA4MeT05X1bSKBGXzpDK4AZ0McUbMqiNnrTYTnvCS6mjeCar1DsKAtpc 2dKG3AVAWd1pCyFPNkdBGKObu+JGaGZdcEGIEZ4fRv7KCGiVVFSFBTapNJR3coUbM/8o xWxJUVvkZOUTuSm7slLJa1xhjVMZa4noakIXycaiRTdbZsLQdJp1V8l6q9ElPj3gWGdn s48w== X-Gm-Message-State: ALoCoQkToA8nZ7koFxWSfQUPpKg1MWVRfaWlLrXe0is9b9g0E/SBMPlCYWVDldE52jQrMzAZ1OLt/6b8pofmWP29StcIZ8WRNw== X-Received: by 10.112.151.102 with SMTP id up6mr2391044lbb.44.1449667368403; Wed, 09 Dec 2015 05:22:48 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l128sm1421008lfd.10.2015.12.09.05.22.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:22:47 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Shiraz Hashim Subject: [PATCH 059/182] gpio: spear-spics: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:22:45 +0100 Message-Id: <1449667365-32576-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: Shiraz Hashim Signed-off-by: Linus Walleij --- drivers/gpio/gpio-spear-spics.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 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-spear-spics.c b/drivers/gpio/gpio-spear-spics.c index bd436b7f86e1..50fb09080a6b 100644 --- a/drivers/gpio/gpio-spear-spics.c +++ b/drivers/gpio/gpio-spear-spics.c @@ -62,8 +62,7 @@ static int spics_get_value(struct gpio_chip *chip, unsigned offset) static void spics_set_value(struct gpio_chip *chip, unsigned offset, int value) { - struct spear_spics *spics = container_of(chip, struct spear_spics, - chip); + struct spear_spics *spics = gpiochip_get_data(chip); u32 tmp; /* select chip select from register */ @@ -94,8 +93,7 @@ static int spics_direction_output(struct gpio_chip *chip, unsigned offset, static int spics_request(struct gpio_chip *chip, unsigned offset) { - struct spear_spics *spics = container_of(chip, struct spear_spics, - chip); + struct spear_spics *spics = gpiochip_get_data(chip); u32 tmp; if (!spics->use_count++) { @@ -110,8 +108,7 @@ static int spics_request(struct gpio_chip *chip, unsigned offset) static void spics_free(struct gpio_chip *chip, unsigned offset) { - struct spear_spics *spics = container_of(chip, struct spear_spics, - chip); + struct spear_spics *spics = gpiochip_get_data(chip); u32 tmp; if (!--spics->use_count) { @@ -168,7 +165,7 @@ static int spics_gpio_probe(struct platform_device *pdev) spics->chip.owner = THIS_MODULE; spics->last_off = -1; - ret = gpiochip_add(&spics->chip); + ret = gpiochip_add_data(&spics->chip, spics); if (ret) { dev_err(&pdev->dev, "unable to add gpio chip\n"); return ret;