core: remove buggy flags sanitization from line-config
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Thu, 4 Jan 2024 13:50:58 +0000 (14:50 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Fri, 5 Jan 2024 08:48:49 +0000 (09:48 +0100)
We try to drop potentially set output flags from line config if edge
detection is enabled but we use the library enum instead of the one from
the uAPI. In any case, we should actually loudly complain if user tries
to use the output mode with edge-detection (like we do currently) so just
remove offending lines entirely.

Reported-by: Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
Reviewed-by: Anne Bezemer <j.a.bezemer@opensourcepartners.nl>
lib/line-config.c

index 2749a2a00b0ef44bf617b9994ff9e9d01f5f882e..9302c1bd6ec7efda08bfe08a4aeefc93d1a3ac39 100644 (file)
@@ -381,18 +381,15 @@ static uint64_t make_kernel_flags(struct gpiod_line_settings *settings)
        case GPIOD_LINE_EDGE_FALLING:
                flags |= (GPIO_V2_LINE_FLAG_EDGE_FALLING |
                          GPIO_V2_LINE_FLAG_INPUT);
-               flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
                break;
        case GPIOD_LINE_EDGE_RISING:
                flags |= (GPIO_V2_LINE_FLAG_EDGE_RISING |
                          GPIO_V2_LINE_FLAG_INPUT);
-               flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
                break;
        case GPIOD_LINE_EDGE_BOTH:
                flags |= (GPIO_V2_LINE_FLAG_EDGE_FALLING |
                          GPIO_V2_LINE_FLAG_EDGE_RISING |
                          GPIO_V2_LINE_FLAG_INPUT);
-               flags &= ~GPIOD_LINE_DIRECTION_OUTPUT;
                break;
        default:
                break;