gpio: cdev: don't report GPIOs requested as interrupts as used
PATCH 1/1 gpio: cdev: don't report GPIOs requested as interrupts as used
From: Bartosz Golaszewski <[email protected]>
GPIOs used as shared irqs can still be requested by user-space (or kernel drivers for that matter) yet we report them as used over the chardev ABI. Drop the test for FLAG_USED_AS_IRQ from gpio_desc_to_lineinfo().
--- drivers/gpio/gpiolib-cdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpio/gpiolib-cdev.c +0 -1
@@ -2275,7 +2275,6 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,*/ if (test_bit (FLAG_REQUESTED , &dflags) ||test_bit (FLAG_IS_HOGGED , &dflags) || -test_bit (FLAG_USED_AS_IRQ , &dflags) ||test_bit (FLAG_EXPORT , &dflags) ||test_bit (FLAG_SYSFS , &dflags) || !gpiochip_line_is_valid (guard.gc, info->offset)) {
Signature · 1 line
2.45.2
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
GPIOs used as shared irqs can still be requested by user-space (or kernel drivers for that matter) yet we report them as used over the chardev ABI. Drop the test for
FLAG_USED_AS_IRQfromgpio_desc_to_lineinfo().Signed-off-by Bartosz Golaszewski <[email protected]>
Quoted 19 lines
--- drivers/gpio/gpiolib-cdev.c | 1 - 1 file changed, 1 deletion(-)drivers/gpio/gpiolib-cdev.c +0
-2@@ -2275,7 +2275,6 @@ static void gpio_desc_to_lineinfo(struct gpio_desc *desc,*/ if (test_bit (FLAG_REQUESTED , &dflags) ||test_bit (FLAG_IS_HOGGED , &dflags) || -test_bit (FLAG_USED_AS_IRQ , &dflags) ||test_bit (FLAG_EXPORT , &dflags) ||test_bit (FLAG_SYSFS , &dflags) || !gpiochip_line_is_valid (guard.gc, info->offset)) { --2.45.2
Quoted 8 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
GPIOs used as shared irqs can still be requested by user-space (or kernel drivers for that matter) yet we report them as used over the chardev ABI. Drop the test for
FLAG_USED_AS_IRQfromgpio_desc_to_lineinfo().Signed-off-by Bartosz Golaszewski <[email protected]>
I think at the time this was added to not let userspace meddle with such GPIO lines since they were used for "something" in the kernel. (Userspace as second-class citizen.)
But I guess this is fine:
Yours,
Linus Walleij
Quoted 10 lines · Linus Walleij
Quoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
GPIOs used as shared irqs can still be requested by user-space (or kernel drivers for that matter) yet we report them as used over the chardev ABI. Drop the test for
FLAG_USED_AS_IRQfromgpio_desc_to_lineinfo().
Quoted 6 lines
Quoted 1 line
Signed-off-by Bartosz Golaszewski <[email protected]>I think at the time this was added to not let userspace meddle with such GPIO lines since they were used for "something" in the kernel. (Userspace as second-class citizen.)
Well, it wouldn't prohibit it. It would just report it misleadingly. Since we'll guard the fixed input direction, I think we should be fine.
Bartosz
Quoted 5 lines
But I guess this is fine:
Reviewed-by Linus Walleij <[email protected]>Yours,
Linus Walleij
Bartosz Golaszewski
AppliedFrom: Bartosz Golaszewski <[email protected]>
Quoted 6 lines · Bartosz Golaszewski
GPIOs used as shared irqs can still be requested by user-space (or kernel drivers for that matter) yet we report them as used over the chardev ABI. Drop the test for
FLAG_USED_AS_IRQfromgpio_desc_to_lineinfo().
Applied, thanks!
[1/1] gpio: cdev: don't report GPIOs requested as interrupts as used
commit: dae01ec714fbbf3a71947668cb61cee4cc320647
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>