* [PATCH] Input: gpio-keys - fix misleading GPIO number
@ 2025-09-24 6:49 Wei
2025-09-24 10:25 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Wei @ 2025-09-24 6:49 UTC (permalink / raw)
To: dmitry.torokhov
Cc: linux-input, linux-kernel, gatien.chevallier, linus.walleij,
namcao, zhiqiang.tu
From: Wei Liu <wei.liu@oss.qualcomm.com>
The error log prints button->gpio, which is unset and default to 0
in non-legacy configurations, leading to misleading messages.
Use desc_to_gpio() to report the actual global GPIO number.
Signed-off-by: Wei Liu <wei.liu@oss.qualcomm.com>
---
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 f9db86da0818..243295a3ea1d 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -584,7 +584,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
error = irq;
dev_err_probe(dev, error,
"Unable to get irq number for GPIO %d\n",
- button->gpio);
+ desc_to_gpio(bdata->gpiod));
return error;
}
bdata->irq = irq;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Input: gpio-keys - fix misleading GPIO number
2025-09-24 6:49 [PATCH] Input: gpio-keys - fix misleading GPIO number Wei
@ 2025-09-24 10:25 ` Linus Walleij
2025-09-25 0:07 ` Dmitry Torokhov
0 siblings, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2025-09-24 10:25 UTC (permalink / raw)
To: Wei
Cc: dmitry.torokhov, linux-input, linux-kernel, gatien.chevallier,
namcao, zhiqiang.tu
On Wed, Sep 24, 2025 at 8:49 AM Wei <wei.liu@oss.qualcomm.com> wrote:
> From: Wei Liu <wei.liu@oss.qualcomm.com>
>
> The error log prints button->gpio, which is unset and default to 0
> in non-legacy configurations, leading to misleading messages.
>
> Use desc_to_gpio() to report the actual global GPIO number.
>
> Signed-off-by: Wei Liu <wei.liu@oss.qualcomm.com>
> ---
> 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 f9db86da0818..243295a3ea1d 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -584,7 +584,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> error = irq;
> dev_err_probe(dev, error,
> "Unable to get irq number for GPIO %d\n",
> - button->gpio);
> + desc_to_gpio(bdata->gpiod));
That's technically a legacy interface.
Can we just not mention the GPIO number?
The only thing that would actually make sense in this kind
of errors is if we add some new interface like:
const char * get_gpiod_debug_string(gpiod);
that can output the chip and line number from the core.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Input: gpio-keys - fix misleading GPIO number
2025-09-24 10:25 ` Linus Walleij
@ 2025-09-25 0:07 ` Dmitry Torokhov
2025-09-25 8:39 ` Linus Walleij
0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2025-09-25 0:07 UTC (permalink / raw)
To: Linus Walleij
Cc: Wei, linux-input, linux-kernel, gatien.chevallier, namcao,
zhiqiang.tu
On Wed, Sep 24, 2025 at 12:25:29PM +0200, Linus Walleij wrote:
> On Wed, Sep 24, 2025 at 8:49 AM Wei <wei.liu@oss.qualcomm.com> wrote:
>
> > From: Wei Liu <wei.liu@oss.qualcomm.com>
> >
> > The error log prints button->gpio, which is unset and default to 0
> > in non-legacy configurations, leading to misleading messages.
> >
> > Use desc_to_gpio() to report the actual global GPIO number.
> >
> > Signed-off-by: Wei Liu <wei.liu@oss.qualcomm.com>
> > ---
> > 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 f9db86da0818..243295a3ea1d 100644
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -584,7 +584,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> > error = irq;
> > dev_err_probe(dev, error,
> > "Unable to get irq number for GPIO %d\n",
> > - button->gpio);
> > + desc_to_gpio(bdata->gpiod));
>
> That's technically a legacy interface.
>
> Can we just not mention the GPIO number?
Yes, there was a patch removing printing this number... We are losing
debug context though.
>
> The only thing that would actually make sense in this kind
> of errors is if we add some new interface like:
>
> const char * get_gpiod_debug_string(gpiod);
I assume the char will be dynamically allocated. Freeing it will be
PITA.
I see vsprintf() has %pC for printing clocks and %pg for block devices,
maybe we could have %pGD or similar for GPIO descriptors?
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Input: gpio-keys - fix misleading GPIO number
2025-09-25 0:07 ` Dmitry Torokhov
@ 2025-09-25 8:39 ` Linus Walleij
0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2025-09-25 8:39 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Wei, linux-input, linux-kernel, gatien.chevallier, namcao,
zhiqiang.tu
On Thu, Sep 25, 2025 at 2:07 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> I see vsprintf() has %pC for printing clocks and %pg for block devices,
> maybe we could have %pGD or similar for GPIO descriptors?
I have no idea how that actually works, but I like this general idea!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-09-25 8:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24 6:49 [PATCH] Input: gpio-keys - fix misleading GPIO number Wei
2025-09-24 10:25 ` Linus Walleij
2025-09-25 0:07 ` Dmitry Torokhov
2025-09-25 8:39 ` Linus Walleij
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).