The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org,
	Prabhakar <prabhakar.csengg@gmail.com>,
	Phil Edworthy <phil.edworthy@renesas.com>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH] Input: gpio-keys - Cancel delayed work only in case of GPIO
Date: Tue, 17 May 2022 21:46:47 -0700	[thread overview]
Message-ID: <YoR6N2ACf3TZr1P5@google.com> (raw)
In-Reply-To: <20220513132500.32395-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

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.

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2022-05-18  4:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-13 13:25 [PATCH] Input: gpio-keys - Cancel delayed work only in case of GPIO Lad Prabhakar
2022-05-17  7:33 ` Geert Uytterhoeven
2022-05-18  4:46 ` Dmitry Torokhov [this message]
2022-05-19  4:58   ` Lad, Prabhakar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YoR6N2ACf3TZr1P5@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=phil.edworthy@renesas.com \
    --cc=prabhakar.csengg@gmail.com \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox