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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dmitry,

Thank you for the review.

On Wed, May 18, 2022 at 5:46 AM Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:
>
> Hi Lad,
>
> On Fri, May 13, 2022 at 02:25:00PM +0100, Lad Prabhakar wrote:
> > 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.
> ...
> > 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



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux