diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-03-11 17:19:51 +0300 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-04-07 10:00:48 +0300 |
commit | 92ac7de3175e3c17cbb76ae752b598cfb9dadf49 (patch) | |
tree | dc4eb8139c917a274af8774f15f6089ebdc16697 /drivers/gpio/gpiolib-cdev.c | |
parent | 0af2f6be1b4281385b618cb86ad946eded089ac8 (diff) | |
download | linux-92ac7de3175e3c17cbb76ae752b598cfb9dadf49.tar.xz |
gpiolib: don't allow setting values on input lines
Some drivers as well as the character device and sysfs code check
whether the line actually is in output mode before allowing the user to
set a value.
However, GPIO value setters now return integer values and can indicate
failures. This allows us to move these checks into the core code.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250311-gpio-set-check-output-v1-1-d971bca9e6fa@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib-cdev.c')
-rw-r--r-- | drivers/gpio/gpiolib-cdev.c | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 107d75558b5a..e6a289fa0f8f 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1366,9 +1366,6 @@ static long linereq_set_values(struct linereq *lr, void __user *ip) /* scan requested lines to determine the subset to be set */ for (num_set = 0, i = 0; i < lr->num_lines; i++) { if (lv.mask & BIT_ULL(i)) { - /* setting inputs is not allowed */ - if (!test_bit(FLAG_IS_OUT, &lr->lines[i].desc->flags)) - return -EPERM; /* add to compacted values */ if (lv.bits & BIT_ULL(i)) __set_bit(num_set, vals); |