]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
gpio: tc3589x: use static container helper
authorLinus Walleij <linus.walleij@linaro.org>
Thu, 27 Aug 2015 12:05:26 +0000 (14:05 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 27 Aug 2015 12:06:33 +0000 (14:06 +0200)
There is a helper function to do the container_of() magic for
the tc3589x GPIO, so use it.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpio-tc3589x.c

index 31b244cffabb2ff9f862e479061e8bcd7e140d7e..d1d585ddb9ab786b2813993de448a3f3b50ab0c5 100644 (file)
@@ -102,7 +102,7 @@ static struct gpio_chip template_chip = {
 static int tc3589x_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct tc3589x_gpio *tc3589x_gpio = container_of(gc, struct tc3589x_gpio, chip);
+       struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(gc);
        int offset = d->hwirq;
        int regoffset = offset / 8;
        int mask = 1 << (offset % 8);
@@ -130,7 +130,7 @@ static int tc3589x_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 static void tc3589x_gpio_irq_lock(struct irq_data *d)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct tc3589x_gpio *tc3589x_gpio = container_of(gc, struct tc3589x_gpio, chip);
+       struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(gc);
 
        mutex_lock(&tc3589x_gpio->irq_lock);
 }
@@ -138,7 +138,7 @@ static void tc3589x_gpio_irq_lock(struct irq_data *d)
 static void tc3589x_gpio_irq_sync_unlock(struct irq_data *d)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct tc3589x_gpio *tc3589x_gpio = container_of(gc, struct tc3589x_gpio, chip);
+       struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(gc);
        struct tc3589x *tc3589x = tc3589x_gpio->tc3589x;
        static const u8 regmap[] = {
                [REG_IBE]       = TC3589x_GPIOIBE0,
@@ -167,7 +167,7 @@ static void tc3589x_gpio_irq_sync_unlock(struct irq_data *d)
 static void tc3589x_gpio_irq_mask(struct irq_data *d)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct tc3589x_gpio *tc3589x_gpio = container_of(gc, struct tc3589x_gpio, chip);
+       struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(gc);
        int offset = d->hwirq;
        int regoffset = offset / 8;
        int mask = 1 << (offset % 8);
@@ -178,7 +178,7 @@ static void tc3589x_gpio_irq_mask(struct irq_data *d)
 static void tc3589x_gpio_irq_unmask(struct irq_data *d)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
-       struct tc3589x_gpio *tc3589x_gpio = container_of(gc, struct tc3589x_gpio, chip);
+       struct tc3589x_gpio *tc3589x_gpio = to_tc3589x_gpio(gc);
        int offset = d->hwirq;
        int regoffset = offset / 8;
        int mask = 1 << (offset % 8);