Commit 171f992511e40da07a4b7dcc7abce21e66e5e456
Committed by
Greg Kroah-Hartman
1 parent
7229e9bfe3
gpio: tps65912: fix wrong container_of arguments
commit 2f97c20e5f7c3582c7310f65a04465bfb0fd0e85 upstream. The gpio_chip operations receive a pointer the gpio_chip struct which is contained in the driver's private struct, yet the container_of call in those functions point to the mfd struct defined in include/linux/mfd/tps65912.h. Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 10 additions and 4 deletions Side-by-side Diff
drivers/gpio/gpio-tps65912.c
... | ... | @@ -26,9 +26,12 @@ |
26 | 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 | 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 | 35 | int val; |
33 | 36 | |
34 | 37 | val = tps65912_reg_read(tps65912, TPS65912_GPIO1 + offset); |
... | ... | @@ -42,7 +45,8 @@ |
42 | 45 | static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, |
43 | 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 | 51 | if (value) |
48 | 52 | tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, |
... | ... | @@ -55,7 +59,8 @@ |
55 | 59 | static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, |
56 | 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 | 65 | /* Set the initial value */ |
61 | 66 | tps65912_gpio_set(gc, offset, value); |
... | ... | @@ -66,7 +71,8 @@ |
66 | 71 | |
67 | 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 | 77 | return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, |
72 | 78 | GPIO_CFG_MASK); |