Re: [PATCH v2] pinctrl: amd: print debounce filter info in debugfs

From: Andy Shevchenko
Date: Mon Oct 26 2020 - 11:21:58 EST


On Mon, Oct 26, 2020 at 5:16 PM Coiby Xu <coiby.xu@xxxxxxxxx> wrote:
>
> Print the status of debounce filter as follows,
> $ cat /sys/kernel/debug/gpio
> pin129 interrupt is disabled| interrupt is masked| disable wakeup in S0i3 state| disable wakeup in S3 state|
> disable wakeup in S4/S5 state| input is high| pull-up is disabled| Pull-down is disabled| output is disabled| debouncing filter disabled| 0x50000
> pin130 interrupt is disabled| interrupt is masked| disable wakeup in S0i3 state| disable wakeup in S3 state|
> disable wakeup in S4/S5 state| input is high| pull-up is disabled| Pull-down is disabled| output is disabled| debouncing filter (high) enabled| debouncing timeout is 124800 (us)| 0x503c8
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Thanks for an update!
In general looks good, one nit below (sorry, missed it in v1 round)

...

> + char debounce_value[40];

(1)

...

> + if (tmr_large) {
> + if (tmr_out_unit)
> + unit = 62500;
> + else

> + unit = 15600;

Side note: Hmm... Shouldn't be 15625? As 1/4.

> + } else {
> + if (tmr_out_unit)
> + unit = 244;
> + else
> + unit = 61;

...


> + snprintf(debounce_value, 40,
> + "debouncing timeout is %u (us)|", time * unit);

(2)

...

> + snprintf(debounce_value, 40, " ");

(3)

Because of definition (1) can you in (2) and (3) use sizeof() ?

--
With Best Regards,
Andy Shevchenko