diff options
Diffstat (limited to 'drivers/gpio')
| -rw-r--r-- | drivers/gpio/gpio-tps65912.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpio/gpio-tps65912.c b/drivers/gpio/gpio-tps65912.c index 472fb5b8779f..9cdbc0c9cb2d 100644 --- a/drivers/gpio/gpio-tps65912.c +++ b/drivers/gpio/gpio-tps65912.c | |||
| @@ -26,9 +26,12 @@ struct tps65912_gpio_data { | |||
| 26 | struct gpio_chip gpio_chip; | 26 | struct gpio_chip gpio_chip; |
| 27 | }; | 27 | }; |
| 28 | 28 | ||
| 29 | #define to_tgd(gc) container_of(gc, struct tps65912_gpio_data, gpio_chip) | ||
| 30 | |||
| 29 | static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) | 31 | static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) |
| 30 | { | 32 | { |
| 31 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 33 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
| 34 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
| 32 | int val; | 35 | int val; |
| 33 | 36 | ||
| 34 | val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); | 37 | val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); |
| @@ -42,7 +45,8 @@ static int tps65912_gpio_get(struct gpio_chip *gc, unsigned offset) | |||
| 42 | static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, | 45 | static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, |
| 43 | int value) | 46 | int value) |
| 44 | { | 47 | { |
| 45 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 48 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
| 49 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
| 46 | 50 | ||
| 47 | if (value) | 51 | if (value) |
| 48 | tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, | 52 | tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, |
| @@ -55,7 +59,8 @@ static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, | |||
| 55 | static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, | 59 | static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, |
| 56 | int value) | 60 | int value) |
| 57 | { | 61 | { |
| 58 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 62 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
| 63 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
| 59 | 64 | ||
| 60 | /* Set the initial value */ | 65 | /* Set the initial value */ |
| 61 | tps65912_gpio_set(gc, offset, value); | 66 | tps65912_gpio_set(gc, offset, value); |
| @@ -66,7 +71,8 @@ static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, | |||
| 66 | 71 | ||
| 67 | static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) | 72 | static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) |
| 68 | { | 73 | { |
| 69 | struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); | 74 | struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); |
| 75 | struct tps65912 *tps65912 = tps65912_gpio->tps65912; | ||
| 70 | 76 | ||
| 71 | return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, | 77 | return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, |
| 72 | GPIO_CFG_MASK); | 78 | GPIO_CFG_MASK); |
