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-fixes-for-v6.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:
"Two more GPIO fixes addressing an issue uncovered by the shared GPIO
management changes in v6.19:

- implement the missing .get_direction() callback for gpio-davinci

- remove redundant check in GPIO core which can also propagate an
invalid errno to user-space"

* tag 'gpio-fixes-for-v6.19-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
gpiolib: remove redundant callback check
gpio: davinci: implement .get_direction()

+18 -3
+18
drivers/gpio/gpio-davinci.c
··· 6 6 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com> 7 7 */ 8 8 9 + #include <linux/cleanup.h> 9 10 #include <linux/gpio/driver.h> 10 11 #include <linux/errno.h> 11 12 #include <linux/kernel.h> ··· 110 109 return __davinci_direction(chip, offset, true, value); 111 110 } 112 111 112 + static int davinci_get_direction(struct gpio_chip *chip, unsigned int offset) 113 + { 114 + struct davinci_gpio_controller *d = gpiochip_get_data(chip); 115 + struct davinci_gpio_regs __iomem *g; 116 + u32 mask = __gpio_mask(offset), val; 117 + int bank = offset / 32; 118 + 119 + g = d->regs[bank]; 120 + 121 + guard(spinlock_irqsave)(&d->lock); 122 + 123 + val = readl_relaxed(&g->dir); 124 + 125 + return (val & mask) ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT; 126 + } 127 + 113 128 /* 114 129 * Read the pin's value (works even if it's set up as output); 115 130 * returns zero/nonzero. ··· 220 203 chips->chip.get = davinci_gpio_get; 221 204 chips->chip.direction_output = davinci_direction_out; 222 205 chips->chip.set = davinci_gpio_set; 206 + chips->chip.get_direction = davinci_get_direction; 223 207 224 208 chips->chip.ngpio = ngpio; 225 209 chips->chip.base = -1;
-3
drivers/gpio/gpiolib.c
··· 468 468 test_bit(GPIOD_FLAG_IS_OUT, &flags)) 469 469 return 0; 470 470 471 - if (!guard.gc->get_direction) 472 - return -ENOTSUPP; 473 - 474 471 ret = gpiochip_get_direction(guard.gc, offset); 475 472 if (ret < 0) 476 473 return ret;