linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: gpio-keys - print button label in IRQ button error messages
@ 2021-09-24  7:18 Geert Uytterhoeven
  2021-10-16  5:34 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-09-24  7:18 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Geert Uytterhoeven

When an error message related to IRQ buttons is printed, no clue is
given about the actual button that caused the failure.  Fix this by
including the button label, to make it more obvious which button has an
incomplete or incorrect hardware description.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/input/keyboard/gpio_keys.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 0f2250c6aa4978d5..fc706918d7b103cb 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -617,14 +617,16 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 		}
 	} else {
 		if (!button->irq) {
-			dev_err(dev, "Found button without gpio or irq\n");
+			dev_err(dev, "Found button %s without gpio or irq\n",
+				desc);
 			return -EINVAL;
 		}
 
 		bdata->irq = button->irq;
 
 		if (button->type && button->type != EV_KEY) {
-			dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n");
+			dev_err(dev, "Only EV_KEY allowed for IRQ button %s\n",
+				desc);
 			return -EINVAL;
 		}
 
-- 
2.25.1


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

* Re: [PATCH] Input: gpio-keys - print button label in IRQ button error messages
  2021-09-24  7:18 [PATCH] Input: gpio-keys - print button label in IRQ button error messages Geert Uytterhoeven
@ 2021-10-16  5:34 ` Dmitry Torokhov
  2021-10-18 11:47   ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2021-10-16  5:34 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-input, linux-kernel

Hi Geert,
On Fri, Sep 24, 2021 at 09:18:02AM +0200, Geert Uytterhoeven wrote:
> When an error message related to IRQ buttons is printed, no clue is
> given about the actual button that caused the failure.  Fix this by
> including the button label, to make it more obvious which button has an
> incomplete or incorrect hardware description.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/input/keyboard/gpio_keys.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index 0f2250c6aa4978d5..fc706918d7b103cb 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -617,14 +617,16 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
>  		}
>  	} else {
>  		if (!button->irq) {
> -			dev_err(dev, "Found button without gpio or irq\n");
> +			dev_err(dev, "Found button %s without gpio or irq\n",
> +				desc);

I do not believe description is mandatory, so we may end up printing
"gpio_keys" here. I wonder if it would not be more reliable to print the
index of the problematic key?

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Input: gpio-keys - print button label in IRQ button error messages
  2021-10-16  5:34 ` Dmitry Torokhov
@ 2021-10-18 11:47   ` Geert Uytterhoeven
  0 siblings, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-10-18 11:47 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Linux Kernel Mailing List

Hi Dmitry,

On Sat, Oct 16, 2021 at 7:34 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Fri, Sep 24, 2021 at 09:18:02AM +0200, Geert Uytterhoeven wrote:
> > When an error message related to IRQ buttons is printed, no clue is
> > given about the actual button that caused the failure.  Fix this by
> > including the button label, to make it more obvious which button has an
> > incomplete or incorrect hardware description.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> >  drivers/input/keyboard/gpio_keys.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> > index 0f2250c6aa4978d5..fc706918d7b103cb 100644
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -617,14 +617,16 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> >               }
> >       } else {
> >               if (!button->irq) {
> > -                     dev_err(dev, "Found button without gpio or irq\n");
> > +                     dev_err(dev, "Found button %s without gpio or irq\n",
> > +                             desc);
>
> I do not believe description is mandatory, so we may end up printing
> "gpio_keys" here. I wonder if it would not be more reliable to print the
> index of the problematic key?

The description (label) is indeed not mandatory, so without that it is
as good as before ;-)

For the index, I'm wondering if the iteration order is unambiguous,
and cannot change?

So perhaps we want to print both ("button %u (%s)")?

Thanks!

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] 3+ messages in thread

end of thread, other threads:[~2021-10-18 11:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  7:18 [PATCH] Input: gpio-keys - print button label in IRQ button error messages Geert Uytterhoeven
2021-10-16  5:34 ` Dmitry Torokhov
2021-10-18 11:47   ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).