* [PATCH] input: gpio-keys - use spin_lock()
@ 2023-09-03 16:03 Lizhe
2023-09-04 7:46 ` Geert Uytterhoeven
0 siblings, 1 reply; 2+ messages in thread
From: Lizhe @ 2023-09-03 16:03 UTC (permalink / raw)
To: dmitry.torokhov, geert+renesas, Jonathan.Cameron, soyer
Cc: linux-input, linux-kernel, Lizhe
Use the spin_lock() and spin_unlock() instead of spin_lock_irqsave()
and spin_unlock_restore()
Signed-off-by: Lizhe <sensor1010@163.com>
---
drivers/input/keyboard/gpio_keys.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index c928829a8b0c..a55d62e1ff6d 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -468,11 +468,10 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
{
struct gpio_button_data *bdata = dev_id;
struct input_dev *input = bdata->input;
- unsigned long flags;
BUG_ON(irq != bdata->irq);
- spin_lock_irqsave(&bdata->lock, flags);
+ spin_lock(&bdata->lock);
if (!bdata->key_pressed) {
if (bdata->button->wakeup)
@@ -495,7 +494,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
ms_to_ktime(bdata->release_delay),
HRTIMER_MODE_REL_HARD);
out:
- spin_unlock_irqrestore(&bdata->lock, flags);
+ spin_unlock(&bdata->lock);
return IRQ_HANDLED;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] input: gpio-keys - use spin_lock()
2023-09-03 16:03 [PATCH] input: gpio-keys - use spin_lock() Lizhe
@ 2023-09-04 7:46 ` Geert Uytterhoeven
0 siblings, 0 replies; 2+ messages in thread
From: Geert Uytterhoeven @ 2023-09-04 7:46 UTC (permalink / raw)
To: Lizhe; +Cc: dmitry.torokhov, Jonathan.Cameron, soyer, linux-input,
linux-kernel
Hi Lizhe,
Thanks for your patch!
On Sun, Sep 3, 2023 at 6:04 PM Lizhe <sensor1010@163.com> wrote:
> Use the spin_lock() and spin_unlock() instead of spin_lock_irqsave()
> and spin_unlock_restore()
Please explain why...
> Signed-off-by: Lizhe <sensor1010@163.com>
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -468,11 +468,10 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
> {
> struct gpio_button_data *bdata = dev_id;
> struct input_dev *input = bdata->input;
> - unsigned long flags;
>
> BUG_ON(irq != bdata->irq);
>
> - spin_lock_irqsave(&bdata->lock, flags);
> + spin_lock(&bdata->lock);
>
> if (!bdata->key_pressed) {
> if (bdata->button->wakeup)
> @@ -495,7 +494,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id)
> ms_to_ktime(bdata->release_delay),
> HRTIMER_MODE_REL_HARD);
> out:
> - spin_unlock_irqrestore(&bdata->lock, flags);
> + spin_unlock(&bdata->lock);
> return IRQ_HANDLED;
> }
Are you sure this is safe, given the interrupt is requested with
devm_request_any_context_irq(), and thus the handler may be registered
using either request_irq() or request_threaded_irq()?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-04 7:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-03 16:03 [PATCH] input: gpio-keys - use spin_lock() Lizhe
2023-09-04 7:46 ` Geert Uytterhoeven
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox