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>,
William Breathitt Gray <vilhelm.gray@gmail.com>
Subject: [PATCH 006/182] gpio: 104-idio-16: use gpiochip data pointer
Date: Wed, 9 Dec 2015 14:13:24 +0100 [thread overview]
Message-ID: <1449666804-30018-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: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/gpio/gpio-104-idio-16.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-104-idio-16.c b/drivers/gpio/gpio-104-idio-16.c
index efe3ff7d574e..019101e05270 100644
--- a/drivers/gpio/gpio-104-idio-16.c
+++ b/drivers/gpio/gpio-104-idio-16.c
@@ -72,14 +72,9 @@ static int idio_16_gpio_direction_output(struct gpio_chip *chip,
return 0;
}
-static struct idio_16_gpio *to_idio16gpio(struct gpio_chip *gc)
-{
- return container_of(gc, struct idio_16_gpio, chip);
-}
-
static int idio_16_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
+ struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
const unsigned mask = BIT(offset-16);
if (offset < 16)
@@ -93,7 +88,7 @@ static int idio_16_gpio_get(struct gpio_chip *chip, unsigned offset)
static void idio_16_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{
- struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
+ struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
const unsigned mask = BIT(offset);
unsigned long flags;
@@ -118,7 +113,7 @@ static void idio_16_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static void idio_16_irq_ack(struct irq_data *data)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
- struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
+ struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
unsigned long flags;
spin_lock_irqsave(&idio16gpio->lock, flags);
@@ -131,7 +126,7 @@ static void idio_16_irq_ack(struct irq_data *data)
static void idio_16_irq_mask(struct irq_data *data)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
- struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
+ struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
const unsigned long mask = BIT(irqd_to_hwirq(data));
unsigned long flags;
@@ -149,7 +144,7 @@ static void idio_16_irq_mask(struct irq_data *data)
static void idio_16_irq_unmask(struct irq_data *data)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
- struct idio_16_gpio *const idio16gpio = to_idio16gpio(chip);
+ struct idio_16_gpio *const idio16gpio = gpiochip_get_data(chip);
const unsigned long mask = BIT(irqd_to_hwirq(data));
const unsigned long prev_irq_mask = idio16gpio->irq_mask;
unsigned long flags;
@@ -236,7 +231,7 @@ static int __init idio_16_probe(struct platform_device *pdev)
dev_set_drvdata(dev, idio16gpio);
- err = gpiochip_add(&idio16gpio->chip);
+ err = gpiochip_add_data(&idio16gpio->chip, idio16gpio);
if (err) {
dev_err(dev, "GPIO registering failed (%d)\n", err);
goto err_gpio_register;
--
2.4.3
next reply other threads:[~2015-12-09 13:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-09 13:13 Linus Walleij [this message]
2015-12-09 18:27 ` [PATCH 006/182] gpio: 104-idio-16: use gpiochip data pointer William Breathitt Gray
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=1449666804-30018-1-git-send-email-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--cc=acourbot@nvidia.com \
--cc=johan@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=mwelling@ieee.org \
--cc=vilhelm.gray@gmail.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).