From patchwork Wed Dec 9 13:24:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58024 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665962lbb; Wed, 9 Dec 2015 05:24:08 -0800 (PST) X-Received: by 10.67.4.42 with SMTP id cb10mr7871813pad.65.1449667448200; Wed, 09 Dec 2015 05:24:08 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fc7si12732909pab.144.2015.12.09.05.24.07; Wed, 09 Dec 2015 05:24:08 -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 S1754144AbbLINYH (ORCPT + 4 others); Wed, 9 Dec 2015 08:24:07 -0500 Received: from mail-lf0-f47.google.com ([209.85.215.47]:36276 "EHLO mail-lf0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbbLINYF (ORCPT ); Wed, 9 Dec 2015 08:24:05 -0500 Received: by lfs39 with SMTP id 39so34288029lfs.3 for ; Wed, 09 Dec 2015 05:24:04 -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=OWewzJEw2I/Q/HbgwzUvJRrzGpXIk9xUOmwdvCu2jrU=; b=hzVuYIFyM29HdqNYjjIY1yrIufJ7vjvcuqcSP9IJW/2V1oYXkzUTUbh3bM6ICr6DZQ E0qoEoAHpV1kxTGeYLtFwzb5h0p6tzhSyD0IZ7QXyEAw0h05btejeS1TV7SN5B2EoDkx qdpQBPYF+qlzNXPjLPOZ1cxFPSBxqhssypb8rkJJSh1O5m4dZuVu7QEtIOXs/iTSVbuM Jrd6mlv26jzzC2h17fIqRGqpdA9jxAh9On7Bph+wY4f2UAQe7VfnW4g4WS8dFSzVdefy jMgVV4giibUsEqCAXo5kxinD/a7HH+dxPVk+sLyJil+rXUpn1GAUaw3AFOGHSzilr4Vg cGqA== 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=OWewzJEw2I/Q/HbgwzUvJRrzGpXIk9xUOmwdvCu2jrU=; b=co8+HnJzNBDoZuBlM0tVu+l3NDj4xQyVwLWhNKi5F2bAZW8bvUp50s6LUiX2ctRPJ+ oaGwR1R8JMF1rO3oO+g1KaLQbRgq4/bB9dREu7jkUcODZ85gjqvKUKMdSe7i5EQWsI6v kQFne9yqwrhrD2hiZtLqJ3yVjtX3+fV9tQ2e3rRaVKu7HTarZsUVBYvGi4dgMgqBfk7A qw6ufA4HUfPop2nkfyPTbpIYy9wI3Efm3oheG3LF1sx9OddDaUM9ekQSPD1nEgFmEBzX BWlwjeWwnmBO11dMSKLXy+qM6Ti6iu2w8Q+rNhm0NFzx54ymLGbgBtFlLbqTXNoRIVB7 o9/g== X-Gm-Message-State: ALoCoQm9wIls8AVzin52dUVVYoL+NnaYdctR2DY6Kig8uc0hNHPonKNRXpXUL8+LUaWUZvUBZIhpbXLXdzNjAIV5zwpcrryh8w== X-Received: by 10.25.145.81 with SMTP id t78mr2269389lfd.86.1449667444634; Wed, 09 Dec 2015 05:24:04 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d2sm1426845lbc.11.2015.12.09.05.24.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:24:03 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Rhyland Klein , Laxman Dewangan Subject: [PATCH 069/182] gpio: tps65910: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:24:01 +0100 Message-Id: <1449667441-619-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: Rhyland Klein Cc: Laxman Dewangan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-tps65910.c | 15 +++++---------- 1 file changed, 5 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-tps65910.c b/drivers/gpio/gpio-tps65910.c index 83894c0387fb..e81eee7627a3 100644 --- a/drivers/gpio/gpio-tps65910.c +++ b/drivers/gpio/gpio-tps65910.c @@ -27,14 +27,9 @@ struct tps65910_gpio { struct tps65910 *tps65910; }; -static inline struct tps65910_gpio *to_tps65910_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct tps65910_gpio, gpio_chip); -} - static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc); + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc); struct tps65910 *tps65910 = tps65910_gpio->tps65910; unsigned int val; @@ -49,7 +44,7 @@ static int tps65910_gpio_get(struct gpio_chip *gc, unsigned offset) static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc); + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc); struct tps65910 *tps65910 = tps65910_gpio->tps65910; if (value) @@ -63,7 +58,7 @@ static void tps65910_gpio_set(struct gpio_chip *gc, unsigned offset, static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset, int value) { - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc); + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc); struct tps65910 *tps65910 = tps65910_gpio->tps65910; /* Set the initial value */ @@ -75,7 +70,7 @@ static int tps65910_gpio_output(struct gpio_chip *gc, unsigned offset, static int tps65910_gpio_input(struct gpio_chip *gc, unsigned offset) { - struct tps65910_gpio *tps65910_gpio = to_tps65910_gpio(gc); + struct tps65910_gpio *tps65910_gpio = gpiochip_get_data(gc); struct tps65910 *tps65910 = tps65910_gpio->tps65910; return tps65910_reg_clear_bits(tps65910, TPS65910_GPIO0 + offset, @@ -175,7 +170,7 @@ static int tps65910_gpio_probe(struct platform_device *pdev) } skip_init: - ret = gpiochip_add(&tps65910_gpio->gpio_chip); + ret = gpiochip_add_data(&tps65910_gpio->gpio_chip, tps65910_gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); return ret;