From patchwork Wed Dec 9 13:17:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 57992 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp662348lbb; Wed, 9 Dec 2015 05:18:00 -0800 (PST) X-Received: by 10.67.7.101 with SMTP id db5mr7774225pad.53.1449667080129; Wed, 09 Dec 2015 05:18:00 -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.17.59; Wed, 09 Dec 2015 05:18:00 -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 S1753984AbbLINR7 (ORCPT + 4 others); Wed, 9 Dec 2015 08:17:59 -0500 Received: from mail-lf0-f41.google.com ([209.85.215.41]:35093 "EHLO mail-lf0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753754AbbLINR7 (ORCPT ); Wed, 9 Dec 2015 08:17:59 -0500 Received: by lfdl133 with SMTP id l133so33842195lfd.2 for ; Wed, 09 Dec 2015 05:17:57 -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=f9CuIwYg/fKhvLT5VRZA1ZrEmKsX3RJJNVc8qlw8BgI=; b=2O6+ep0ubRYg6C0I6Xkc9YzVw1FLF8ltu6O7HTgwIpqF1dhVIjemCGoZzuuBlJQ+fD C72qk1ySMTMVo0/bcPUuyJxfcNEyFftejvBu2v6Zxk9EJgLl9381O3ImfZkQHbvo3ZX3 /sqC0Pu+SyE8ulsJZKS/Vwk/BITuUpdInwzIrdPozDBCXaJLSlDrmsHPxDHLKdmvnoHW xoMB7RAzJZu33Lc4ZPnB8E1PoBW62DySuMN7AjkXTtr61/Sp0pyHIBtW121eJlrpK3to Fz3ysUe/fBP2NBAyBUpl4dFnNsNGxn4ox0NY9ousV3HatbzVWSSpQSYoUQYKgEYRtBlZ 4BMw== 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=f9CuIwYg/fKhvLT5VRZA1ZrEmKsX3RJJNVc8qlw8BgI=; b=GYnMzYMUwtPxsBMMeCz2dftMXPUlCiPa4mLVf8H68VFWiajufmtKbs6ZdOHHwDp9/r j1zhAPlntdxxl6LMs2tQ4pFK1ZZucxn5NaOc0jR7haOBpifvuo1EEkDFmlf6pET0juPj 1sl0fV6KqrcEuU7/Q5N3HLfzP7X/Z0bDYcLYyBuVgy/mhRBPJq2fweEfPmUuk7TN5AHK Z5r52kSNuPceGYgNbJ6veI9/EPlGkaLeW/c+fCSNl7VjhKbAFpGaE/w23yL2PwL9ihqU yWcjbpD3ZedRMYwHbqODlbTfrEA/CJCbRDVzyN079dv2hRYwETesiH39xMUZRNBhuGHC ppDA== X-Gm-Message-State: ALoCoQnRUCKSKQjOHqBFGLtLGKZSk33vYxssgTxGzuTDStmJ+VR2VG9NXaIUXfHMjwmwu3h1b2RwdANrg8KbE0vxYW4UHh+6+w== X-Received: by 10.25.150.72 with SMTP id y69mr2254080lfd.91.1449667077740; Wed, 09 Dec 2015 05:17:57 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l67sm1429120lfl.26.2015.12.09.05.17.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:17:57 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , wu guoxing Subject: [PATCH 037/182] gpio: mc9s08dz60: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:17:53 +0100 Message-Id: <1449667073-31503-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: wu guoxing Signed-off-by: Linus Walleij --- drivers/gpio/gpio-mc9s08dz60.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 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-mc9s08dz60.c b/drivers/gpio/gpio-mc9s08dz60.c index 45f176018378..ba22fb92a6e7 100644 --- a/drivers/gpio/gpio-mc9s08dz60.c +++ b/drivers/gpio/gpio-mc9s08dz60.c @@ -29,12 +29,6 @@ struct mc9s08dz60 { struct gpio_chip chip; }; -static inline struct mc9s08dz60 *to_mc9s08dz60(struct gpio_chip *gc) -{ - return container_of(gc, struct mc9s08dz60, chip); -} - - static void mc9s_gpio_to_reg_and_bit(int offset, u8 *reg, u8 *bit) { *reg = 0x20 + offset / GPIO_NUM_PER_GROUP; @@ -45,7 +39,7 @@ static int mc9s08dz60_get_value(struct gpio_chip *gc, unsigned offset) { u8 reg, bit; s32 value; - struct mc9s08dz60 *mc9s = to_mc9s08dz60(gc); + struct mc9s08dz60 *mc9s = gpiochip_get_data(gc); mc9s_gpio_to_reg_and_bit(offset, ®, &bit); value = i2c_smbus_read_byte_data(mc9s->client, reg); @@ -75,7 +69,7 @@ static int mc9s08dz60_set(struct mc9s08dz60 *mc9s, unsigned offset, int val) static void mc9s08dz60_set_value(struct gpio_chip *gc, unsigned offset, int val) { - struct mc9s08dz60 *mc9s = to_mc9s08dz60(gc); + struct mc9s08dz60 *mc9s = gpiochip_get_data(gc); mc9s08dz60_set(mc9s, offset, val); } @@ -83,7 +77,7 @@ static void mc9s08dz60_set_value(struct gpio_chip *gc, unsigned offset, int val) static int mc9s08dz60_direction_output(struct gpio_chip *gc, unsigned offset, int val) { - struct mc9s08dz60 *mc9s = to_mc9s08dz60(gc); + struct mc9s08dz60 *mc9s = gpiochip_get_data(gc); return mc9s08dz60_set(mc9s, offset, val); } @@ -109,7 +103,7 @@ static int mc9s08dz60_probe(struct i2c_client *client, mc9s->client = client; i2c_set_clientdata(client, mc9s); - return gpiochip_add(&mc9s->chip); + return gpiochip_add_data(&mc9s->chip, mc9s); } static int mc9s08dz60_remove(struct i2c_client *client)