Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'gpio-v4.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
"Two GPIO fixes:

- Fix a translation problem in of_get_named_gpiod_flags()

- Fix a long standing container_of() mistake in the TPS65912 driver"

* tag 'gpio-v4.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
gpio: tps65912: fix wrong container_of arguments
gpiolib: of: allow of_gpiochip_find_and_xlate to find more than one chip per node

+15 -8
+10 -4
drivers/gpio/gpio-tps65912.c
··· 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); ··· 45 42 static void tps65912_gpio_set(struct gpio_chip *gc, unsigned offset, 46 43 int value) 47 44 { 48 - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); 45 + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); 46 + struct tps65912 *tps65912 = tps65912_gpio->tps65912; 49 47 50 48 if (value) 51 49 tps65912_set_bits(tps65912, TPS65912_GPIO1 + offset, ··· 59 55 static int tps65912_gpio_output(struct gpio_chip *gc, unsigned offset, 60 56 int value) 61 57 { 62 - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); 58 + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); 59 + struct tps65912 *tps65912 = tps65912_gpio->tps65912; 63 60 64 61 /* Set the initial value */ 65 62 tps65912_gpio_set(gc, offset, value); ··· 71 66 72 67 static int tps65912_gpio_input(struct gpio_chip *gc, unsigned offset) 73 68 { 74 - struct tps65912 *tps65912 = container_of(gc, struct tps65912, gpio); 69 + struct tps65912_gpio_data *tps65912_gpio = to_tgd(gc); 70 + struct tps65912 *tps65912 = tps65912_gpio->tps65912; 75 71 76 72 return tps65912_clear_bits(tps65912, TPS65912_GPIO1 + offset, 77 73 GPIO_CFG_MASK);
+5 -4
drivers/gpio/gpiolib-of.c
··· 46 46 47 47 ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); 48 48 if (ret < 0) { 49 - /* We've found the gpio chip, but the translation failed. 50 - * Return true to stop looking and return the translation 51 - * error via out_gpio 49 + /* We've found a gpio chip, but the translation failed. 50 + * Store translation error in out_gpio. 51 + * Return false to keep looking, as more than one gpio chip 52 + * could be registered per of-node. 52 53 */ 53 54 gg_data->out_gpio = ERR_PTR(ret); 54 - return true; 55 + return false; 55 56 } 56 57 57 58 gg_data->out_gpio = gpiochip_get_desc(gc, ret);