From patchwork Wed Dec 9 13:45:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58113 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp678134lbb; Wed, 9 Dec 2015 05:45:31 -0800 (PST) X-Received: by 10.98.87.136 with SMTP id i8mr13019218pfj.94.1449668731070; Wed, 09 Dec 2015 05:45:31 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rn8si12811415pab.174.2015.12.09.05.45.30; Wed, 09 Dec 2015 05:45:31 -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 S1754750AbbLINp1 (ORCPT + 4 others); Wed, 9 Dec 2015 08:45:27 -0500 Received: from mail-lf0-f49.google.com ([209.85.215.49]:35621 "EHLO mail-lf0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753092AbbLINp0 (ORCPT ); Wed, 9 Dec 2015 08:45:26 -0500 Received: by lfdl133 with SMTP id l133so34375171lfd.2 for ; Wed, 09 Dec 2015 05:45:25 -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=Gf3ORxO5vqfhgVm+bijfFwphBmktH/ifAAHC/3wjthQ=; b=K7gQpRyCdYeZbeh+yBbWAaMo+cPWndl0A87WxXUNeebJpZh3g7Tj4O53f9WBgD5P+f HtAT/CzP/VZkOL3QuRFo/c65DbwOF2/tZ7BYhsJ0plDF7x8XFCMIQFgecLwjh+m1rOUp S2Sb+VBx0svG8QYnsOWbdfnAu14GrHEe/DgPbZz5SuBdeIEsG+/4pfVh7nNOwbo5D1e4 lyFCzQ0y8LcrZ2X8i+HJVsatXVU4TDMWKWCwWcZ7Xw22oKUmSsuGuyDp11JuQ1cf5gyt K66i77eCNToz7WmxLNgRgEZZshQdUxxX92Z6bzWw1Uu0nWKL6OLoeEk6/m5u9ry0g9+/ 6E6g== 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=Gf3ORxO5vqfhgVm+bijfFwphBmktH/ifAAHC/3wjthQ=; b=CsECbHoNRnTZPsgtwUzXYCMJ2w0vff7SUmpPV9+b1dz303xUT4MgAQv3wN5bU3Ldro y8P0MaoFK1ZPkVHODjQiDo1IQrn3u4VGyDByxjfAPuWhLbRthmRjEXviJPzVDFd97P50 DRg8O/jxcqJscwLoSdyMneqAV1Ggza1AhmDNNsV+snm/Kb1fxO6QICk8yqZVL3jtVvHK Mes+HWFksYF07Lcu7T7v8YxPQ93qSNrpib1BHjRK937LmDj5PuqLl4b1OjTbROhe36z3 ohvAsHbo28nkF3/hQX6k/DbJzMpJ/mSPxeSQQsV+dplIeXdnO0cB/kB9ktRF6KyZ8rXg ++cQ== X-Gm-Message-State: ALoCoQkKz1nVj576faDH6r2rZ4PpSQHhZNVRoRdneNE7hRoyMlH8HWuqie01WMW/xaJ98bGGMRNu+G6GLkjBAkPHgh3viY2MnQ== X-Received: by 10.25.210.143 with SMTP id j137mr1911035lfg.115.1449668724931; Wed, 09 Dec 2015 05:45:24 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id oq10sm1437841lbb.29.2015.12.09.05.45.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:45:24 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann , Michael Hennerich , Dmitry Torokhov Cc: Linus Walleij Subject: [PATCH 157/182] input: ad7879: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:45:21 +0100 Message-Id: <1449668721-5832-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: Michael Hennerich Cc: Dmitry Torokhov Signed-off-by: Linus Walleij --- Dmitry: please ACK this so I can take it through the GPIO tree. --- drivers/input/touchscreen/ad7879.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 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/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 16b5cc2196f2..583a0590ceb2 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c @@ -379,7 +379,7 @@ static const struct attribute_group ad7879_attr_group = { static int ad7879_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) { - struct ad7879 *ts = container_of(chip, struct ad7879, gc); + struct ad7879 *ts = gpiochip_get_data(chip); int err; mutex_lock(&ts->mutex); @@ -393,7 +393,7 @@ static int ad7879_gpio_direction_input(struct gpio_chip *chip, static int ad7879_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level) { - struct ad7879 *ts = container_of(chip, struct ad7879, gc); + struct ad7879 *ts = gpiochip_get_data(chip); int err; mutex_lock(&ts->mutex); @@ -412,7 +412,7 @@ static int ad7879_gpio_direction_output(struct gpio_chip *chip, static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio) { - struct ad7879 *ts = container_of(chip, struct ad7879, gc); + struct ad7879 *ts = gpiochip_get_data(chip); u16 val; mutex_lock(&ts->mutex); @@ -425,7 +425,7 @@ static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio) static void ad7879_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value) { - struct ad7879 *ts = container_of(chip, struct ad7879, gc); + struct ad7879 *ts = gpiochip_get_data(chip); mutex_lock(&ts->mutex); if (value) @@ -456,7 +456,7 @@ static int ad7879_gpio_add(struct ad7879 *ts, ts->gc.owner = THIS_MODULE; ts->gc.parent = ts->dev; - ret = gpiochip_add(&ts->gc); + ret = gpiochip_add_data(&ts->gc, ts); if (ret) dev_err(ts->dev, "failed to register gpio %d\n", ts->gc.base);