From: Linus Walleij <linus.walleij@linaro.org>
To: linux-gpio@vger.kernel.org, Johan Hovold <johan@kernel.org>,
Alexandre Courbot <acourbot@nvidia.com>,
Michael Welling <mwelling@ieee.org>,
Markus Pargmann <mpa@pengutronix.de>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Laxman Dewangan <ldewangan@nvidia.com>,
Andrew Chew <achew@nvidia.com>,
Stephen Warren <swarren@nvidia.com>
Subject: [PATCH 047/182] gpio: palmas: use gpiochip data pointer
Date: Wed, 9 Dec 2015 14:19:18 +0100 [thread overview]
Message-ID: <1449667158-31977-1-git-send-email-linus.walleij@linaro.org> (raw)
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 <ldewangan@nvidia.com>
Cc: Andrew Chew <achew@nvidia.com>
Cc: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-palmas.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
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;
--
2.4.3
next reply other threads:[~2015-12-09 13:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 13:19 Linus Walleij [this message]
2015-12-22 5:55 ` [PATCH 047/182] gpio: palmas: use gpiochip data pointer Laxman Dewangan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449667158-31977-1-git-send-email-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=achew@nvidia.com \
--cc=acourbot@nvidia.com \
--cc=johan@kernel.org \
--cc=ldewangan@nvidia.com \
--cc=linux-gpio@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=mwelling@ieee.org \
--cc=swarren@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).