mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpiolib: fix inverted trace values in gpiod_get_array_value()
@ 2026-11-20 13:02 Jan Schär
  0 siblings, 0 replies; only message in thread
From: Jan Schär @ 2026-11-20 13:02 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, Jan Schär

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@jschaer.ch>
---
 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-20 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 13:02 [PATCH] gpiolib: fix inverted trace values in gpiod_get_array_value() Jan Schär

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®