Skip to contentSkip to conversation

tools: gpio: fix debounce_period_us output of lsgpio

PATCH Applied Milo Spadacini 4 participants 4 messages May 8, 2023 – May 11, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 tools: gpio: fix debounce_period_us output of lsgpio

Fix incorrect output that could occur when more attributes are used and GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.

---
V2 -> V3 add signature
V1 -> V2 fix commit syntax

---
 tools/gpio/lsgpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/gpio/lsgpio.c +1 -1
index c61d061247e1..52a0be45410c 100644
@@ -94,7 +94,7 @@ static void print_attributes(struct gpio_v2_line_info *info)
 	for (i = 0; i < info->num_attrs; i++) {
 		if (info->attrs[i].id == GPIO_V2_LINE_ATTR_ID_DEBOUNCE)
 			fprintf(stdout, ", debounce_period=%dusec",
-				info->attrs[0].debounce_period_us);
+				info->attrs[i].debounce_period_us);
 	}
 }
 
Signature · 1 line
2.34.1
Reviewed-by
#2 lore raw
Quoted 7 lines · Linus Walleij
Quoted 4 lines · Milo Spadacini

Fix incorrect output that could occur when more attributes are used and GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.

I'm not sure if we need a Fixes tag, but anyway LGTM as well:

Quoted 2 lines

Thanks Milo!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
In reply to Milo Spadacini
Quoted 26 lines · Milo Spadacini

Fix incorrect output that could occur when more attributes are used and GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.

---
V2 -> V3 add signature
V1 -> V2 fix commit syntax

---
 tools/gpio/lsgpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/gpio/lsgpio.c +1 -2
index c61d061247e1..52a0be45410c 100644
@@ -94,7 +94,7 @@ static void print_attributes(struct gpio_v2_line_info *info)
        for (i = 0; i < info->num_attrs; i++) {
                if (info->attrs[i].id == GPIO_V2_LINE_ATTR_ID_DEBOUNCE)
                        fprintf(stdout, ", debounce_period=%dusec",
-                               info->attrs[0].debounce_period_us);
+                               info->attrs[i].debounce_period_us);
        }
 }
 
--
Quoted 2 lines

2.34.1

Applied, thanks!

Bart