[PATCH] gpiolib: fix inverted trace values in gpiod_get_array_value()

From: Jan Schär

Date: Fri Nov 20 2026 - 08:02:43 EST


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")
Signed-off-by: Jan Schär <jan@xxxxxxxxxx>
---
drivers/gpio/gpiolib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 2a220f10f0e5..c924fc65c622 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -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
--
2.53.0