mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 20:46:48 +02:00
gpio fixes for v6.19-rc6
- 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
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEEkeUTLeW1Rh17omX8BZ0uy/82hMMFAmlqHwAACgkQBZ0uy/82
hMPlqA/7BCNp4OLeEBcs6EXERSoTLdllY4Z1and2UTzRZ7ioyckDJtwehQKKiZG/
3H0LtB948kq7RV19vrJLjQzDOm7j68eNdV0nIfeSjiS+UWqjnohmbJM3bgzG6IzL
l4N1ZHsKr2nsc/OaFS7felLED5GZ5mynoPzsy4tQQgvEeNLJGSTj06f0KcVbwK2K
mFUveKyuTa1o3QNIuu8P2BdKZC3rApP8KA2pAusuUmrQ1yNkolDZehWySVNTtlfT
N2504JQgy/rFl/tudjtYz4e0d1gWcjqgwcJ8n6Sw3lA8dS9COsSTpDDlri0c7lTB
nMXBSigS0A+vD6H0FtNhXIvejqQ075gfys1iUBOAGMfoDaSDTr36MtOMjwg2tpQt
5AZHJYzngrOpLADq40lxHAxSJtH0Zh/xWHWkVSxOZ+ol5Yv7NdCy80D24wr8p72r
D4aCYjfu+XF24rkEp7eIXecHSt8tFh5LRkNG9A0gWVQWsNyTd1NfJppykmcoE9Z5
DNZdYREpFJ08rS5cyUE4EKUPuOrGv0in9RevdoUOk58SoRSACnUaXT9ME4BJ3plE
l0f1indq1pA72bhOytvVIEpk236xcR1bRYcfqHe386xHq8xtaWSJBe5UQ0dgDrD2
KllaPA0uh3+wY+tRpiJIi4cwksacx3O8WaQ3fC7Chne4JrOxO1s=
=jof/
-----END PGP SIGNATURE-----
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()
This commit is contained in:
commit
c2a44a02d7
|
|
@ -6,6 +6,7 @@
|
|||
* Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
|
||||
*/
|
||||
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/gpio/driver.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -109,6 +110,22 @@ davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value)
|
|||
return __davinci_direction(chip, offset, true, value);
|
||||
}
|
||||
|
||||
static int davinci_get_direction(struct gpio_chip *chip, unsigned int offset)
|
||||
{
|
||||
struct davinci_gpio_controller *d = gpiochip_get_data(chip);
|
||||
struct davinci_gpio_regs __iomem *g;
|
||||
u32 mask = __gpio_mask(offset), val;
|
||||
int bank = offset / 32;
|
||||
|
||||
g = d->regs[bank];
|
||||
|
||||
guard(spinlock_irqsave)(&d->lock);
|
||||
|
||||
val = readl_relaxed(&g->dir);
|
||||
|
||||
return (val & mask) ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the pin's value (works even if it's set up as output);
|
||||
* returns zero/nonzero.
|
||||
|
|
@ -203,6 +220,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
|
|||
chips->chip.get = davinci_gpio_get;
|
||||
chips->chip.direction_output = davinci_direction_out;
|
||||
chips->chip.set = davinci_gpio_set;
|
||||
chips->chip.get_direction = davinci_get_direction;
|
||||
|
||||
chips->chip.ngpio = ngpio;
|
||||
chips->chip.base = -1;
|
||||
|
|
|
|||
|
|
@ -468,9 +468,6 @@ int gpiod_get_direction(struct gpio_desc *desc)
|
|||
test_bit(GPIOD_FLAG_IS_OUT, &flags))
|
||||
return 0;
|
||||
|
||||
if (!guard.gc->get_direction)
|
||||
return -ENOTSUPP;
|
||||
|
||||
ret = gpiochip_get_direction(guard.gc, offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user