From patchwork Wed Dec 9 13:23: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: 58023 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp665893lbb; Wed, 9 Dec 2015 05:23:59 -0800 (PST) X-Received: by 10.98.7.66 with SMTP id b63mr12669410pfd.19.1449667439289; Wed, 09 Dec 2015 05:23:59 -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.23.59; Wed, 09 Dec 2015 05:23:59 -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 S1754142AbbLINX6 (ORCPT + 4 others); Wed, 9 Dec 2015 08:23:58 -0500 Received: from mail-lf0-f53.google.com ([209.85.215.53]:36206 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753902AbbLINX6 (ORCPT ); Wed, 9 Dec 2015 08:23:58 -0500 Received: by lfs39 with SMTP id 39so34285443lfs.3 for ; Wed, 09 Dec 2015 05:23:56 -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=Rk0kKo3XsCmCQESbRBIN/cTgto9FlhNu4mtzmaxUZqs=; b=gvjz0peRjuG3mr1j/vqS6CVs4HVuWhqJ4g9vABhVPRixNvEyH/cTTYhCfTjt0oLVuh KWjtJx5QUau+ZI/PSWj720cmeHIvQ7GOeoWc9GALoG1bTW0/CyTfU8+2bA8KrRw90R5u uVfaCL5CNOWL+K7f1XaZHakANNKUETl+SIn58lI8uGdNDleW8EPEO5eeQXE/wjsKlk3Z DPf1RO6tVJeE+dPgnZRqCeDHtnJ1i5EDa+5zG7CFAynLz/1DUXPNi6RT5NUHnIgjcvFu z31aQBHpTApDmSUQWfyGDN9UQjhXh2QSgCZZ8VDQmr6lZC0qm9suuouRmxpy+EYZ/R2P gHWQ== 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=Rk0kKo3XsCmCQESbRBIN/cTgto9FlhNu4mtzmaxUZqs=; b=DKojSqRKqM2P86j1S/MtQeSLtIkD8oCeTfuJyPrN6pLhoApCx+qo7s/a3FXf2hVefC pPlLKMIe4sMjbdqDrjtj+qCMQc99b/zGbZOAU8EjOP9GI6miByJ7r3Cg33I4xEL0gRHM nDCMGaAkEcYx5S1wpQ8+mSGVC3vMK5ED3/nUmEujIO15hEQvY+fAkFV+neT9Zcl+gC7r /kgw8b3xhOFCWqiuADjabCF3LHh08CcA1Y44fz4yKD014KIMPd9+0TlwQ0BNVNG2Fgf5 rwKKzXjAPOk6caHQ0GwzBYqzgob9hLDEoYsnnQRUufnJPUj99pAeBZYFhjVecGJNi1FK +gUg== X-Gm-Message-State: ALoCoQmk2op9porF1Q0V6HxMhri7nh09AcSbhNTOfFrGzs1vdnC6ZVHhAL4R7tUNPpAUgLec0PekyiC6cAtyr7ZnBE1f2W05tg== X-Received: by 10.25.89.70 with SMTP id n67mr2324564lfb.160.1449667436578; Wed, 09 Dec 2015 05:23:56 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id wu10sm1426555lbb.44.2015.12.09.05.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:23:55 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Laxman Dewangan Subject: [PATCH 068/182] gpio: tps6586x: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:23:53 +0100 Message-Id: <1449667433-567-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: Laxman Dewangan Signed-off-by: Linus Walleij --- drivers/gpio/gpio-tps6586x.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-tps6586x.c b/drivers/gpio/gpio-tps6586x.c index 89b2249100b0..87de5486a29e 100644 --- a/drivers/gpio/gpio-tps6586x.c +++ b/drivers/gpio/gpio-tps6586x.c @@ -38,14 +38,9 @@ struct tps6586x_gpio { struct device *parent; }; -static inline struct tps6586x_gpio *to_tps6586x_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct tps6586x_gpio, gpio_chip); -} - static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); + struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); uint8_t val; int ret; @@ -59,7 +54,7 @@ static int tps6586x_gpio_get(struct gpio_chip *gc, unsigned offset) static void tps6586x_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); + struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); tps6586x_update(tps6586x_gpio->parent, TPS6586X_GPIOSET2, value << offset, 1 << offset); @@ -68,7 +63,7 @@ static void tps6586x_gpio_set(struct gpio_chip *gc, unsigned offset, static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset, int value) { - struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); + struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); uint8_t val, mask; tps6586x_gpio_set(gc, offset, value); @@ -82,7 +77,7 @@ static int tps6586x_gpio_output(struct gpio_chip *gc, unsigned offset, static int tps6586x_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct tps6586x_gpio *tps6586x_gpio = to_tps6586x_gpio(gc); + struct tps6586x_gpio *tps6586x_gpio = gpiochip_get_data(gc); return tps6586x_irq_get_virq(tps6586x_gpio->parent, TPS6586X_INT_PLDO_0 + offset); @@ -122,7 +117,7 @@ static int tps6586x_gpio_probe(struct platform_device *pdev) else tps6586x_gpio->gpio_chip.base = -1; - ret = gpiochip_add(&tps6586x_gpio->gpio_chip); + ret = gpiochip_add_data(&tps6586x_gpio->gpio_chip, tps6586x_gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); return ret;