From patchwork Wed Dec 9 13:19:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 58002 Delivered-To: patch@linaro.org Received: by 10.112.147.194 with SMTP id tm2csp663244lbb; Wed, 9 Dec 2015 05:19:30 -0800 (PST) X-Received: by 10.98.16.216 with SMTP id 85mr12946495pfq.64.1449667170658; Wed, 09 Dec 2015 05:19:30 -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.19.30; Wed, 09 Dec 2015 05:19:30 -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 S1754074AbbLINTa (ORCPT + 4 others); Wed, 9 Dec 2015 08:19:30 -0500 Received: from mail-lb0-f172.google.com ([209.85.217.172]:34417 "EHLO mail-lb0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbbLINT3 (ORCPT ); Wed, 9 Dec 2015 08:19:29 -0500 Received: by lbbcs9 with SMTP id cs9so29740817lbb.1 for ; Wed, 09 Dec 2015 05:19:27 -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=v+Sc96JzcnkYbGrsjmyJp28B+zWCCNOR321Y+CQKKu8=; b=QxMBZmO7/2KoGg/2mSBB09Ums/kx4wZlBFJQI0gcV/jTV6umTaOweoCO59iT2zVvTX ySN3OU1FhLyUh/oH2rw32SIMY/5hdCPJimnGb1RFQ42CSnBw/4B3TU+zrS0xdQ12LHHD hZg8/ELPyIXYALE9Sfh6KvXw4T0JlHPTE7RWyDJDaxbdWBJh1bTTwGww5/dJTYZUk4M6 mpXPfQZNXso87mppy9gUg6IpJxbEd2NaYroVp3r/hAAQ/Qwvc1kZ5cscZGJ7cehHV7Oz mgP84XmGoIU3HGFsr/+VfyUsRVDCGatAh50gR+MJHv2bs4z1dnnmoOkV+wSqZrvL295j c2Lg== 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=v+Sc96JzcnkYbGrsjmyJp28B+zWCCNOR321Y+CQKKu8=; b=Bwva9YqLcjOA7fTN8lhjyDc++4utUhKoXy2/1z4VW2D/whSv8d1ZZZysYx7NEx7h4h dQT6Z5m2fPN7+mFeU/7wMS/PAaWcygvSNALv8ZHCfpTzOj6ZO4xHLMLMEao00bJz2iKQ UeRy/RZrHfEP1W4fsfoErmLg9FnYBoRfXGs5GZUSZx43ESsLcThbKtl/NUqJDdjx6ewR OKYyv3NLdDFhnO1sL051QpfJl0iAd1dRb1D7th3d5+wZcwky9/LVzqtHQstFUCVnhzJt R/tdotukcjmzx8j5jGwE4L/plRAZwbsW/k9WWxqY0ptmG17Fxqg5UqoKOUyHdtsseOWf C+QA== X-Gm-Message-State: ALoCoQlbYAiPgikHsFAHucWt0khYq+t036fjlI3hrzXlV08KHy4KV+zF1CpZRQBo/Hx8MXO6dJxAhnZzWXJWC62Mj7/E3rFQ+A== X-Received: by 10.112.129.98 with SMTP id nv2mr2257187lbb.17.1449667167779; Wed, 09 Dec 2015 05:19:27 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id re5sm1420182lbb.22.2015.12.09.05.19.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2015 05:19:21 -0800 (PST) From: Linus Walleij To: linux-gpio@vger.kernel.org, Johan Hovold , Alexandre Courbot , Michael Welling , Markus Pargmann Cc: Linus Walleij , Laxman Dewangan , Andrew Chew , Stephen Warren Subject: [PATCH 047/182] gpio: palmas: use gpiochip data pointer Date: Wed, 9 Dec 2015 14:19:18 +0100 Message-Id: <1449667158-31977-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 Cc: Andrew Chew Cc: Stephen Warren Signed-off-by: Linus Walleij --- drivers/gpio/gpio-palmas.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-palmas.c b/drivers/gpio/gpio-palmas.c index 5f09ed1700dc..fec4e868afc8 100644 --- a/drivers/gpio/gpio-palmas.c +++ b/drivers/gpio/gpio-palmas.c @@ -35,14 +35,9 @@ struct palmas_device_data { int ngpio; }; -static inline struct palmas_gpio *to_palmas_gpio(struct gpio_chip *chip) -{ - return container_of(chip, struct palmas_gpio, gpio_chip); -} - static int palmas_gpio_get(struct gpio_chip *gc, unsigned offset) { - struct palmas_gpio *pg = to_palmas_gpio(gc); + struct palmas_gpio *pg = gpiochip_get_data(gc); struct palmas *palmas = pg->palmas; unsigned int val; int ret; @@ -74,7 +69,7 @@ static int palmas_gpio_get(struct gpio_chip *gc, unsigned offset) static void palmas_gpio_set(struct gpio_chip *gc, unsigned offset, int value) { - struct palmas_gpio *pg = to_palmas_gpio(gc); + struct palmas_gpio *pg = gpiochip_get_data(gc); struct palmas *palmas = pg->palmas; int ret; unsigned int reg; @@ -96,7 +91,7 @@ static void palmas_gpio_set(struct gpio_chip *gc, unsigned offset, static int palmas_gpio_output(struct gpio_chip *gc, unsigned offset, int value) { - struct palmas_gpio *pg = to_palmas_gpio(gc); + struct palmas_gpio *pg = gpiochip_get_data(gc); struct palmas *palmas = pg->palmas; int ret; unsigned int reg; @@ -118,7 +113,7 @@ static int palmas_gpio_output(struct gpio_chip *gc, unsigned offset, static int palmas_gpio_input(struct gpio_chip *gc, unsigned offset) { - struct palmas_gpio *pg = to_palmas_gpio(gc); + struct palmas_gpio *pg = gpiochip_get_data(gc); struct palmas *palmas = pg->palmas; int ret; unsigned int reg; @@ -136,7 +131,7 @@ static int palmas_gpio_input(struct gpio_chip *gc, unsigned offset) static int palmas_gpio_to_irq(struct gpio_chip *gc, unsigned offset) { - struct palmas_gpio *pg = to_palmas_gpio(gc); + struct palmas_gpio *pg = gpiochip_get_data(gc); struct palmas *palmas = pg->palmas; return palmas_irq_get_virq(palmas, PALMAS_GPIO_0_IRQ + offset); @@ -198,7 +193,7 @@ static int palmas_gpio_probe(struct platform_device *pdev) else palmas_gpio->gpio_chip.base = -1; - ret = gpiochip_add(&palmas_gpio->gpio_chip); + ret = gpiochip_add_data(&palmas_gpio->gpio_chip, palmas_gpio); if (ret < 0) { dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret); return ret;