diff mbox series

[v3] tools: gpio: fix debounce_period_us output of lsgpio

Message ID 20230508131848.142602-1-milo.spadacini@gmail.com
State Accepted
Commit eb4b8eca1bad98f4b8574558a74f041f9acb5a54
Headers show
Series [v3] tools: gpio: fix debounce_period_us output of lsgpio | expand

Commit Message

Milo Spadacini May 8, 2023, 1:18 p.m. UTC
Fix incorrect output that could occur when more attributes are used and
GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.

Signed-off-by: Milo Spadacini <milo.spadacini@gmail.com>
---
V2 -> V3 add signature
V1 -> V2 fix commit syntax
---
 tools/gpio/lsgpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bartosz Golaszewski May 11, 2023, 8:56 a.m. UTC | #1
On Mon, May 8, 2023 at 3:20 PM Milo Spadacini <milo.spadacini@gmail.com> wrote:
>
> Fix incorrect output that could occur when more attributes are used and
> GPIO_V2_LINE_ATTR_ID_DEBOUNCE is not the first one.
>
> Signed-off-by: Milo Spadacini <milo.spadacini@gmail.com>
> ---
> V2 -> V3 add signature
> V1 -> V2 fix commit syntax
> ---
>  tools/gpio/lsgpio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
> index c61d061247e1..52a0be45410c 100644
> --- a/tools/gpio/lsgpio.c
> +++ b/tools/gpio/lsgpio.c
> @@ -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);
>         }
>  }
>
> --
> 2.34.1
>

Applied, thanks!

Bart
diff mbox series

Patch

diff --git a/tools/gpio/lsgpio.c b/tools/gpio/lsgpio.c
index c61d061247e1..52a0be45410c 100644
--- a/tools/gpio/lsgpio.c
+++ b/tools/gpio/lsgpio.c
@@ -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);
 	}
 }