Thread (4 messages) 4 messages, 4 authors, 2022-05-19

Re: [PATCH] Input: gpio-keys - Cancel delayed work only in case of GPIO

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Date: 2022-05-19 04:59:13
Also in: linux-renesas-soc, lkml

Hi Dmitry,

Thank you for the review.

On Wed, May 18, 2022 at 5:46 AM Dmitry Torokhov
[off-list ref] wrote:
Hi Lad,

On Fri, May 13, 2022 at 02:25:00PM +0100, Lad Prabhakar wrote:
quoted
gpio_keys module can either accept gpios or interrupts. The module
initializes delayed work in case of gpios only and not for interrupts,
so make sure cancel_delayed_work_sync() is called only when bdata->gpiod
is true.
...
quoted
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index d75a8b179a8a..ec9d50ddda42 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -133,7 +133,7 @@ static void gpio_keys_quiesce_key(void *data)
              hrtimer_cancel(&bdata->release_timer);
      if (bdata->debounce_use_hrtimer)
              hrtimer_cancel(&bdata->debounce_timer);
-     else
+     else if (bdata->gpiod)
              cancel_delayed_work_sync(&bdata->work);
We already have a check for bdata->gpiod a couple lines above. I think
the chunk should look like this:

        if (!bdata->gpiod)
                hrtimer_cancel(&bdata->release_timer);
        else if (bdata->debounce_use_hrtimer)
                hrtimer_cancel(&bdata->debounce_timer);
        else
                cancel_delayed_work_sync(&bdata->work);

since we use debounce timer/work only when we deal with gpio-backed
keys.
Agreed, will fix that in v2.

Cheers,
Prabhakar
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help