From 0f1229f8a4ded5a08f91bdecbab6032729fefb8a Mon Sep 17 00:00:00 2001 From: Ksawlii Date: Sun, 24 Nov 2024 00:23:31 +0100 Subject: [PATCH] Revert "gpiolib: cdev: Ignore reconfiguration without direction" This reverts commit e527ce374535d2074950c512c443824d0a6f0c85. --- drivers/gpio/gpiolib-cdev.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index 56eb2be71..95861916d 100755 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -1110,18 +1110,15 @@ static long linereq_set_config_unlocked(struct linereq *lr, for (i = 0; i < lr->num_lines; i++) { desc = lr->lines[i].desc; flags = gpio_v2_line_config_flags(lc, i); - /* - * Lines not explicitly reconfigured as input or output - * are left unchanged. - */ - if (!(flags & GPIO_V2_LINE_DIRECTION_FLAGS)) - continue; - polarity_change = (!!test_bit(FLAG_ACTIVE_LOW, &desc->flags) != ((flags & GPIO_V2_LINE_FLAG_ACTIVE_LOW) != 0)); gpio_v2_line_config_flags_to_desc_flags(flags, &desc->flags); + /* + * Lines have to be requested explicitly for input + * or output, else the line will be treated "as is". + */ if (flags & GPIO_V2_LINE_FLAG_OUTPUT) { int val = gpio_v2_line_config_output_value(lc, i); @@ -1129,7 +1126,7 @@ static long linereq_set_config_unlocked(struct linereq *lr, ret = gpiod_direction_output(desc, val); if (ret) return ret; - } else { + } else if (flags & GPIO_V2_LINE_FLAG_INPUT) { ret = gpiod_direction_input(desc); if (ret) return ret;