Commit 050c5429 authored by Linus Walleij's avatar Linus Walleij

ARM: scoop: use gpiochip data pointer

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: arm@kernel.org
Cc: Richard Purdie <rpurdie@rpsys.net>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 69fd6aea
...@@ -69,7 +69,7 @@ static void __scoop_gpio_set(struct scoop_dev *sdev, ...@@ -69,7 +69,7 @@ static void __scoop_gpio_set(struct scoop_dev *sdev,
static void scoop_gpio_set(struct gpio_chip *chip, unsigned offset, int value) static void scoop_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
{ {
struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); struct scoop_dev *sdev = gpiochip_get_data(chip);
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&sdev->scoop_lock, flags); spin_lock_irqsave(&sdev->scoop_lock, flags);
...@@ -81,7 +81,7 @@ static void scoop_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ...@@ -81,7 +81,7 @@ static void scoop_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset) static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset)
{ {
struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); struct scoop_dev *sdev = gpiochip_get_data(chip);
/* XXX: I'm unsure, but it seems so */ /* XXX: I'm unsure, but it seems so */
return !!(ioread16(sdev->base + SCOOP_GPRR) & (1 << (offset + 1))); return !!(ioread16(sdev->base + SCOOP_GPRR) & (1 << (offset + 1)));
...@@ -90,7 +90,7 @@ static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset) ...@@ -90,7 +90,7 @@ static int scoop_gpio_get(struct gpio_chip *chip, unsigned offset)
static int scoop_gpio_direction_input(struct gpio_chip *chip, static int scoop_gpio_direction_input(struct gpio_chip *chip,
unsigned offset) unsigned offset)
{ {
struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); struct scoop_dev *sdev = gpiochip_get_data(chip);
unsigned long flags; unsigned long flags;
unsigned short gpcr; unsigned short gpcr;
...@@ -108,7 +108,7 @@ static int scoop_gpio_direction_input(struct gpio_chip *chip, ...@@ -108,7 +108,7 @@ static int scoop_gpio_direction_input(struct gpio_chip *chip,
static int scoop_gpio_direction_output(struct gpio_chip *chip, static int scoop_gpio_direction_output(struct gpio_chip *chip,
unsigned offset, int value) unsigned offset, int value)
{ {
struct scoop_dev *sdev = container_of(chip, struct scoop_dev, gpio); struct scoop_dev *sdev = gpiochip_get_data(chip);
unsigned long flags; unsigned long flags;
unsigned short gpcr; unsigned short gpcr;
...@@ -224,7 +224,7 @@ static int scoop_probe(struct platform_device *pdev) ...@@ -224,7 +224,7 @@ static int scoop_probe(struct platform_device *pdev)
devptr->gpio.direction_input = scoop_gpio_direction_input; devptr->gpio.direction_input = scoop_gpio_direction_input;
devptr->gpio.direction_output = scoop_gpio_direction_output; devptr->gpio.direction_output = scoop_gpio_direction_output;
ret = gpiochip_add(&devptr->gpio); ret = gpiochip_add_data(&devptr->gpio, devptr);
if (ret) if (ret)
goto err_gpio; goto err_gpio;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment