Revert "gpiolib: cdev: Ignore reconfiguration without direction"

This reverts commit e527ce3745.
This commit is contained in:
Ksawlii 2024-11-24 00:23:31 +01:00
parent d9a5f63b5f
commit 0f1229f8a4

View file

@ -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;