Skip to contentSkip to conversation

gpiolib: fix inverted trace values in gpiod_get_array_value()

PATCH New Jan Schär 1 participant 1 message Nov 20 GPIO

lore
Share & tools
lore

Jan Schär

author
#0 lore raw

PATCH 1/1 gpiolib: fix inverted trace values in gpiod_get_array_value()

Almost all trace_gpio_value() calls report the raw value. gpiod_get_array_value_complex() is the only exception; it reports the logical value in traces unless the caller requests raw values. This inconsistency makes GPIO traces confusing.

Move the trace call earlier, where the value is still raw. Now, all GPIO traces consistently report raw values.

Fixes eec1d566cdf9 ("gpio: Introduce ->get_multiple callback")
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpiolib.c +1 -1
index 2a220f10f0e5..c924fc65c622 100644
@@ -3644,10 +3644,10 @@ int gpiod_get_array_value_complex(bool raw, bool can_sleep,
 			int hwgpio = gpiod_hwgpio(desc);
 			int value = test_bit(hwgpio, bits);
 
+			trace_gpio_value(desc_to_gpio(desc), 1, value);
 			if (!raw && test_bit(GPIOD_FLAG_ACTIVE_LOW, &desc->flags))
 				value = !value;
 			__assign_bit(j, value_bitmap, value);
-			trace_gpio_value(desc_to_gpio(desc), 1, value);
 			j++;
 
 			if (array_info)

base-commit: c6d8ebd7324cefda867a701b4341605b681aa3f5

Signature · 1 line
2.53.0