mirror of
https://github.com/torvalds/linux.git
synced 2024-12-26 12:52:30 +00:00
gpio: sysfs: repair export returning -EPERM on 1st attempt
It would make sense to return -EPERM if the bit was already set (already
used), not if it was cleared. Before this fix pins can only be exported on
the 2nd attempt:
$ echo 522 > /sys/class/gpio/export
sh: write error: Operation not permitted
$ echo 522 > /sys/class/gpio/export
Fixes: 35b545332b
("gpio: remove gpio_lock")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
297dc37a1e
commit
8636f19c2d
@ -593,7 +593,7 @@ int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
|
||||
if (!guard.gc)
|
||||
return -ENODEV;
|
||||
|
||||
if (!test_and_set_bit(FLAG_EXPORT, &desc->flags))
|
||||
if (test_and_set_bit(FLAG_EXPORT, &desc->flags))
|
||||
return -EPERM;
|
||||
|
||||
gdev = desc->gdev;
|
||||
|
Loading…
Reference in New Issue
Block a user