From patchwork Wed Dec 9 13:16:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57982 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp661468lbb; Wed, 9 Dec 2015 05:16:35 -0800 (PST) X-Received: by 10.66.139.72 with SMTP id qw8mr7156570pab.130.1449666995625; Wed, 09 Dec 2015 05:16:35 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s26si12711651pfi.57.2015.12.09.05.16.35; Wed, 09 Dec 2015 05:16:35 -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 S1753331AbbLINQf (ORCPT + 4 others); Wed, 9 Dec 2015 08:16:35 -0500 Received: from mail-lf0-f42.google.com ([209.85.215.42]:36312 "EHLO mail-lf0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbbLINQe (ORCPT ); Wed, 9 Dec 2015 08:16:34 -0500 Received: by lfs39 with SMTP id 39so34140397lfs.3 for ; Wed, 09 Dec 2015 05:16:33 -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:mime-version:content-type :content-transfer-encoding; bh=gCdWTMoVS9Inlg2lXO1pilZCWNgh9xDUMbe2c28brX4=; b=lk5NL1FmaEuRo9R49jrVHd/CF4DpGs8dZi9yoEtCm5vOzrA1n6WMVB0ApgwlaZSlHx utlq2ygm/lqBzjlJV2CpagXqWOWJisOGMlpeshPmQcviLCddp4VNujnTIDDkHsqPO1xa Py9JSUb+DuDLklfllIf9EJs/PnT0W/s0c0qktUct79QEtJihn0TywGQnb5DpPQR3eqRW V5ilgjMFjEq60Ekp4T/icCGl9nba+N+bx/KVSeq2YAfpyhCkiEUjMKfEBYvSh9pgVAcq KTPa1nqgGR/+7zY0gpIiMQ7LqaTpzc7IHQp8VDIPtvf2W7Dd3952iBNZKEiC82H4pi9U 6DlA== 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:mime-version :content-type:content-transfer-encoding; bh=gCdWTMoVS9Inlg2lXO1pilZCWNgh9xDUMbe2c28brX4=; b=juO+l1TigKsGHIRxtw/BKpXarzPWDl/tmx7wbrQTpsayXmhN4x4yZcyhYERV83ZWlU ZoTRQPS+xVSYlusV3Qn7hXS2waarFKVIxjVGgIGbEirLhLjUPWyIvdzWi8qMjcf7pHb9 sgfNut0Q4lyNEr41994EyfXb4WwHj4zd2m5mt0zKnQsOWrETrEOkf2rc/RdA2PV0iXi+ kP6tqnnsmgIKSH7QzheMmawsPEmTHGRTg/2iTgFk0t7FBNdQ/Ms9jP1lrZUs+hcEuJaI 3O6GIhI/j0zo6Lzt2SL3kcq/GVO0PXfinVCeIlkCxSSgvJrnOowY63Woyn6YcboqVwHM Ch5w== X-Gm-Message-State: ALoCoQlxqVNTyC99ybzDFiQuP5g3LFkiunKW6AHOCZIN3VWPlB3I3nPrEQ0FrfR+EPmq3kw+ZkmuLtv6nJNZaVd1GJ2U5itS+w== X-Received: by 10.25.218.196 with SMTP id r187mr2280748lfg.59.1449666993192; Wed, 09 Dec 2015 05:16:33 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id ak1sm1404141lbc.2.2015.12.09.05.16.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:16:32 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Subject: [PATCH 027/182] gpio: it87: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:16:29 +0100 Message-Id: <1449666989-31028-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 MIME-Version: 1.0 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: Diego Elio Pettenò Signed-off-by: Linus Walleij --- drivers/gpio/gpio-it87.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-it87.c b/drivers/gpio/gpio-it87.c index 21f6f7c0eb34..b219c82414bf 100644 --- a/drivers/gpio/gpio-it87.c +++ b/drivers/gpio/gpio-it87.c @@ -77,11 +77,6 @@ static struct it87_gpio it87_gpio_chip = { .lock = __SPIN_LOCK_UNLOCKED(it87_gpio_chip.lock), }; -static inline struct it87_gpio *to_it87_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct it87_gpio, chip); -} - /* Superio chip access functions; copied from wdt_it87 */ static inline int superio_enter(void) @@ -165,7 +160,7 @@ static int it87_gpio_request(struct gpio_chip *chip, unsigned gpio_num) { u8 mask, group; int rc = 0; - struct it87_gpio *it87_gpio = to_it87_gpio(chip); + struct it87_gpio *it87_gpio = gpiochip_get_data(chip); mask = 1 << (gpio_num % 8); group = (gpio_num / 8); @@ -198,7 +193,7 @@ static int it87_gpio_get(struct gpio_chip *chip, unsigned gpio_num) { u16 reg; u8 mask; - struct it87_gpio *it87_gpio = to_it87_gpio(chip); + struct it87_gpio *it87_gpio = gpiochip_get_data(chip); mask = 1 << (gpio_num % 8); reg = (gpio_num / 8) + it87_gpio->io_base; @@ -210,7 +205,7 @@ static int it87_gpio_direction_in(struct gpio_chip *chip, unsigned gpio_num) { u8 mask, group; int rc = 0; - struct it87_gpio *it87_gpio = to_it87_gpio(chip); + struct it87_gpio *it87_gpio = gpiochip_get_data(chip); mask = 1 << (gpio_num % 8); group = (gpio_num / 8); @@ -236,7 +231,7 @@ static void it87_gpio_set(struct gpio_chip *chip, { u8 mask, curr_vals; u16 reg; - struct it87_gpio *it87_gpio = to_it87_gpio(chip); + struct it87_gpio *it87_gpio = gpiochip_get_data(chip); mask = 1 << (gpio_num % 8); reg = (gpio_num / 8) + it87_gpio->io_base; @@ -253,7 +248,7 @@ static int it87_gpio_direction_out(struct gpio_chip *chip, { u8 mask, group; int rc = 0; - struct it87_gpio *it87_gpio = to_it87_gpio(chip); + struct it87_gpio *it87_gpio = gpiochip_get_data(chip); mask = 1 << (gpio_num % 8); group = (gpio_num / 8); @@ -380,7 +375,7 @@ static int __init it87_gpio_init(void) it87_gpio->chip.names = (const char *const*)labels_table; - rc = gpiochip_add(&it87_gpio->chip); + rc = gpiochip_add_data(&it87_gpio->chip, it87_gpio); if (rc) goto labels_free;