Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: gpio-keys - do not BUG() on requested wakeirqs
@ 2026-11-04 16:03 Andreas Kemnade
  2026-11-04 22:28 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Kemnade @ 2026-11-04 16:03 UTC (permalink / raw)
  To: dmitry.torokhov, andreas, bartosz.golaszewski, marco.crivellari,
	arnd, tony, linux-input, linux-kernel, brgl

Having the IRQ handler called when enabled IRQs arrive should be considered
as a feature not as a bug. So do not BUG() there when this happens.

Fixes: 3717194f24922 ("Input: gpio-keys - add system suspend support for dedicated wakeirqs")
Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/input/keyboard/gpio_keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index fbc31c5db3db..f1c31c5366f0 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -412,7 +412,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
 {
 	struct gpio_button_data *bdata = dev_id;
 
-	BUG_ON(irq != bdata->irq);
+	BUG_ON((irq != bdata->irq) && (irq != bdata->wakeirq));
 
 	if (bdata->button->wakeup) {
 		const struct gpio_keys_button *button = bdata->button;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: gpio-keys - do not BUG() on requested wakeirqs
  2026-11-04 16:03 [PATCH] Input: gpio-keys - do not BUG() on requested wakeirqs Andreas Kemnade
@ 2026-11-04 22:28 ` Dmitry Torokhov
  2026-11-05  6:19   ` Andreas Kemnade
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2026-11-04 22:28 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: bartosz.golaszewski, marco.crivellari, arnd, tony, linux-input,
	linux-kernel, brgl

Hi Andreas,

On Wed, Nov 04, 2026 at 05:03:05PM +0100, Andreas Kemnade wrote:
> Having the IRQ handler called when enabled IRQs arrive should be considered
> as a feature not as a bug. So do not BUG() there when this happens.
>
> Fixes: 3717194f24922 ("Input: gpio-keys - add system suspend support for dedicated wakeirqs")
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  drivers/input/keyboard/gpio_keys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index fbc31c5db3db..f1c31c5366f0 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -412,7 +412,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
>  {
>  	struct gpio_button_data *bdata = dev_id;
>  
> -	BUG_ON(irq != bdata->irq);
> +	BUG_ON((irq != bdata->irq) && (irq != bdata->wakeirq));
>  
>  	if (bdata->button->wakeup) {
>  		const struct gpio_keys_button *button = bdata->button;

Doesn't gpio_keys_irq_isr() have the same issue when a wakeirq is
configured for an interrupt-only button?

Also, neither gpio_keys_gpio_isr() nor gpio_keys_irq_isr() uses the irq
argument for anything else, so instead of expanding the condition, could
we simply drop the BUG_ON() from both handlers?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: gpio-keys - do not BUG() on requested wakeirqs
  2026-11-04 22:28 ` Dmitry Torokhov
@ 2026-11-05  6:19   ` Andreas Kemnade
  2026-11-05 16:46     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Kemnade @ 2026-11-05  6:19 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: bartosz.golaszewski, marco.crivellari, arnd, tony, linux-input,
	linux-kernel, brgl

On Wed, 04 Nov 2026 14:28:15 -0800
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> Hi Andreas,
> 
> On Wed, Nov 04, 2026 at 05:03:05PM +0100, Andreas Kemnade wrote:
> > Having the IRQ handler called when enabled IRQs arrive should be considered
> > as a feature not as a bug. So do not BUG() there when this happens.
> >
> > Fixes: 3717194f24922 ("Input: gpio-keys - add system suspend support for dedicated wakeirqs")
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> >  drivers/input/keyboard/gpio_keys.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> > index fbc31c5db3db..f1c31c5366f0 100644
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -412,7 +412,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
> >  {
> >  	struct gpio_button_data *bdata = dev_id;
> >  
> > -	BUG_ON(irq != bdata->irq);
> > +	BUG_ON((irq != bdata->irq) && (irq != bdata->wakeirq));
> >  
> >  	if (bdata->button->wakeup) {
> >  		const struct gpio_keys_button *button = bdata->button;  
> 
> Doesn't gpio_keys_irq_isr() have the same issue when a wakeirq is
> configured for an interrupt-only button?
> 
yes, it has.

> Also, neither gpio_keys_gpio_isr() nor gpio_keys_irq_isr() uses the irq
> argument for anything else, so instead of expanding the condition, could
> we simply drop the BUG_ON() from both handlers?
>
Sure, was just unsure about the intention of escalating things so much here.
I think we should trust the interrupt system a bit.

Regards,
Andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Input: gpio-keys - do not BUG() on requested wakeirqs
  2026-11-05  6:19   ` Andreas Kemnade
@ 2026-11-05 16:46     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2026-11-05 16:46 UTC (permalink / raw)
  To: Andreas Kemnade
  Cc: bartosz.golaszewski, marco.crivellari, arnd, tony, linux-input,
	linux-kernel, brgl

On Thu, Nov 05, 2026 at 07:19:52AM +0100, Andreas Kemnade wrote:
> On Wed, 04 Nov 2026 14:28:15 -0800
> Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> 
> > Hi Andreas,
> > 
> > On Wed, Nov 04, 2026 at 05:03:05PM +0100, Andreas Kemnade wrote:
> > > Having the IRQ handler called when enabled IRQs arrive should be considered
> > > as a feature not as a bug. So do not BUG() there when this happens.
> > >
> > > Fixes: 3717194f24922 ("Input: gpio-keys - add system suspend support for dedicated wakeirqs")
> > > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > > ---
> > >  drivers/input/keyboard/gpio_keys.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> > > index fbc31c5db3db..f1c31c5366f0 100644
> > > --- a/drivers/input/keyboard/gpio_keys.c
> > > +++ b/drivers/input/keyboard/gpio_keys.c
> > > @@ -412,7 +412,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id)
> > >  {
> > >  	struct gpio_button_data *bdata = dev_id;
> > >  
> > > -	BUG_ON(irq != bdata->irq);
> > > +	BUG_ON((irq != bdata->irq) && (irq != bdata->wakeirq));
> > >  
> > >  	if (bdata->button->wakeup) {
> > >  		const struct gpio_keys_button *button = bdata->button;  
> > 
> > Doesn't gpio_keys_irq_isr() have the same issue when a wakeirq is
> > configured for an interrupt-only button?
> > 
> yes, it has.
> 
> > Also, neither gpio_keys_gpio_isr() nor gpio_keys_irq_isr() uses the irq
> > argument for anything else, so instead of expanding the condition, could
> > we simply drop the BUG_ON() from both handlers?
> >
> Sure, was just unsure about the intention of escalating things so much here.
> I think we should trust the interrupt system a bit.

Will you be sending a new patch?

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-05 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 16:03 [PATCH] Input: gpio-keys - do not BUG() on requested wakeirqs Andreas Kemnade
2026-11-04 22:28 ` Dmitry Torokhov
2026-11-05  6:19   ` Andreas Kemnade
2026-11-05 16:46     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox