summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2015-12-07 13:43:28 (GMT)
committerLinus Walleij <linus.walleij@linaro.org>2016-01-05 10:21:15 (GMT)
commit92a41e2f73879373a4ce2df4b2137d03ba1289ec (patch)
tree329686315e14492b1f2e992dccf7c83462628a4d /drivers/gpio
parentb0d384733c05906b807cbb9a1b732ad12b521dbe (diff)
downloadlinux-92a41e2f73879373a4ce2df4b2137d03ba1289ec.tar.xz
gpio: timberdale: 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(). Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-timberdale.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index dda8f21..a6de10c 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -53,7 +53,7 @@ struct timbgpio {
static int timbgpio_update_bit(struct gpio_chip *gpio, unsigned index,
unsigned offset, bool enabled)
{
- struct timbgpio *tgpio = container_of(gpio, struct timbgpio, gpio);
+ struct timbgpio *tgpio = gpiochip_get_data(gpio);
u32 reg;
spin_lock(&tgpio->lock);
@@ -77,7 +77,7 @@ static int timbgpio_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)
static int timbgpio_gpio_get(struct gpio_chip *gpio, unsigned nr)
{
- struct timbgpio *tgpio = container_of(gpio, struct timbgpio, gpio);
+ struct timbgpio *tgpio = gpiochip_get_data(gpio);
u32 value;
value = ioread32(tgpio->membase + TGPIOVAL);
@@ -98,7 +98,7 @@ static void timbgpio_gpio_set(struct gpio_chip *gpio,
static int timbgpio_to_irq(struct gpio_chip *gpio, unsigned offset)
{
- struct timbgpio *tgpio = container_of(gpio, struct timbgpio, gpio);
+ struct timbgpio *tgpio = gpiochip_get_data(gpio);
if (tgpio->irq_base <= 0)
return -EINVAL;
@@ -279,7 +279,7 @@ static int timbgpio_probe(struct platform_device *pdev)
gc->ngpio = pdata->nr_pins;
gc->can_sleep = false;
- err = gpiochip_add(gc);
+ err = gpiochip_add_data(gc, tgpio);
if (err)
return err;