linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 005/182] gpio: 104-idi-48: use gpiochip data pointer
@ 2015-12-09 13:13 Linus Walleij
  2015-12-09 18:26 ` William Breathitt Gray
  0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2015-12-09 13:13 UTC (permalink / raw)
  To: linux-gpio, Johan Hovold, Alexandre Courbot, Michael Welling,
	Markus Pargmann
  Cc: Linus Walleij, William Breathitt Gray

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-idi-48.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
index b5c693409a58..779db930da8b 100644
--- a/drivers/gpio/gpio-104-idi-48.c
+++ b/drivers/gpio/gpio-104-idi-48.c
@@ -62,14 +62,9 @@ static int idi_48_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
 	return 0;
 }
 
-static struct idi_48_gpio *to_idi48gpio(struct gpio_chip *gc)
-{
-	return container_of(gc, struct idi_48_gpio, chip);
-}
-
 static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset)
 {
-	struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip);
+	struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
 	unsigned i;
 	const unsigned register_offset[6] = { 0, 1, 2, 4, 5, 6 };
 	unsigned base_offset;
@@ -90,7 +85,7 @@ static int idi_48_gpio_get(struct gpio_chip *chip, unsigned offset)
 static void idi_48_irq_ack(struct irq_data *data)
 {
 	struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
-	struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip);
+	struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
 	unsigned long flags;
 
 	spin_lock_irqsave(&idi48gpio->lock, flags);
@@ -103,7 +98,7 @@ static void idi_48_irq_ack(struct irq_data *data)
 static void idi_48_irq_mask(struct irq_data *data)
 {
 	struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
-	struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip);
+	struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
 	const unsigned offset = irqd_to_hwirq(data);
 	unsigned i;
 	unsigned mask;
@@ -134,7 +129,7 @@ static void idi_48_irq_mask(struct irq_data *data)
 static void idi_48_irq_unmask(struct irq_data *data)
 {
 	struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
-	struct idi_48_gpio *const idi48gpio = to_idi48gpio(chip);
+	struct idi_48_gpio *const idi48gpio = gpiochip_get_data(chip);
 	const unsigned offset = irqd_to_hwirq(data);
 	unsigned i;
 	unsigned mask;
@@ -256,7 +251,7 @@ static int __init idi_48_probe(struct platform_device *pdev)
 
 	dev_set_drvdata(dev, idi48gpio);
 
-	err = gpiochip_add(&idi48gpio->chip);
+	err = gpiochip_add_data(&idi48gpio->chip, idi48gpio);
 	if (err) {
 		dev_err(dev, "GPIO registering failed (%d)\n", err);
 		goto err_gpio_register;
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 005/182] gpio: 104-idi-48: use gpiochip data pointer
  2015-12-09 13:13 [PATCH 005/182] gpio: 104-idi-48: use gpiochip data pointer Linus Walleij
@ 2015-12-09 18:26 ` William Breathitt Gray
  0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2015-12-09 18:26 UTC (permalink / raw)
  To: Linus Walleij, linux-gpio, Johan Hovold, Alexandre Courbot,
	Michael Welling, Markus Pargmann

On 12/09/2015 08:13 AM, Linus Walleij wrote:
> 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>

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-09 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 13:13 [PATCH 005/182] gpio: 104-idi-48: use gpiochip data pointer Linus Walleij
2015-12-09 18:26 ` William Breathitt Gray

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).