All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio
@ 2024-03-05 10:10 Uwe Kleine-König
  2024-03-05 10:18 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-05 10:10 UTC (permalink / raw)
  To: Dmitry Torokhov, Linus Walleij, Krzysztof Kozlowski,
	Andy Shevchenko
  Cc: linux-input, kernel

On a PC Engines APU our admins are faced with:

	$ dmesg | grep -c "gpio-keys-polled gpio-keys-polled: unable to claim gpio 0, err=-517"
	261

Such a message always appears when e.g. a new USB device is plugged in.

Suppress this message which considerably clutters the kernel log for
EPROBE_DEFER (i.e. -517).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

there are a few other exit paths that could use dev_err_probe(), but IIRC
Dmitry isn't a fan of using dev_err_probe() where the return value cannot be
EPROBE_DEFER, so I'm only changing this one error path.

Best regards
Uwe

 drivers/input/keyboard/gpio_keys_polled.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index ba00ecfbd343..b41fd1240f43 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -315,12 +315,10 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 
 			error = devm_gpio_request_one(dev, button->gpio,
 					flags, button->desc ? : DRV_NAME);
-			if (error) {
-				dev_err(dev,
-					"unable to claim gpio %u, err=%d\n",
-					button->gpio, error);
-				return error;
-			}
+			if (error)
+				return dev_err_probe(dev, error,
+						     "unable to claim gpio %u\n",
+						     button->gpio);
 
 			bdata->gpiod = gpio_to_desc(button->gpio);
 			if (!bdata->gpiod) {

base-commit: 11afac187274a6177a7ac82997f8691c0f469e41
-- 
2.43.0


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

* Re: [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio
  2024-03-05 10:10 [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio Uwe Kleine-König
@ 2024-03-05 10:18 ` Linus Walleij
  2024-03-05 17:01 ` Andy Shevchenko
  2024-03-05 17:15 ` Dmitry Torokhov
  2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2024-03-05 10:18 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Dmitry Torokhov, Krzysztof Kozlowski, Andy Shevchenko,
	linux-input, kernel

On Tue, Mar 5, 2024 at 11:10 AM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:

> On a PC Engines APU our admins are faced with:
>
>         $ dmesg | grep -c "gpio-keys-polled gpio-keys-polled: unable to claim gpio 0, err=-517"
>         261
>
> Such a message always appears when e.g. a new USB device is plugged in.
>
> Suppress this message which considerably clutters the kernel log for
> EPROBE_DEFER (i.e. -517).
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Fair enough,
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio
  2024-03-05 10:10 [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio Uwe Kleine-König
  2024-03-05 10:18 ` Linus Walleij
@ 2024-03-05 17:01 ` Andy Shevchenko
  2024-03-05 17:11   ` Dmitry Torokhov
  2024-03-05 17:15 ` Dmitry Torokhov
  2 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2024-03-05 17:01 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Dmitry Torokhov, Linus Walleij, Krzysztof Kozlowski, linux-input,
	kernel

On Tue, Mar 5, 2024 at 12:10 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:

...

> there are a few other exit paths that could use dev_err_probe(), but IIRC
> Dmitry isn't a fan of using dev_err_probe() where the return value cannot be
> EPROBE_DEFER, so I'm only changing this one error path.

It's not true anymore. He is fine with that API, and please use it.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio
  2024-03-05 17:01 ` Andy Shevchenko
@ 2024-03-05 17:11   ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2024-03-05 17:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Uwe Kleine-König, Linus Walleij, Krzysztof Kozlowski,
	linux-input, kernel

On Tue, Mar 05, 2024 at 07:01:02PM +0200, Andy Shevchenko wrote:
> On Tue, Mar 5, 2024 at 12:10 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> 
> ...
> 
> > there are a few other exit paths that could use dev_err_probe(), but IIRC
> > Dmitry isn't a fan of using dev_err_probe() where the return value cannot be
> > EPROBE_DEFER, so I'm only changing this one error path.
> 
> It's not true anymore. He is fine with that API, and please use it.

I would not get ahead of ourselves ;) I still think we could have done
this better by:

1. Having a format option for printing symbolic errors
2. Recording deferral source at supplier level

But yes, I am accepting patches and new drivers using dev_err_probe().

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio
  2024-03-05 10:10 [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio Uwe Kleine-König
  2024-03-05 10:18 ` Linus Walleij
  2024-03-05 17:01 ` Andy Shevchenko
@ 2024-03-05 17:15 ` Dmitry Torokhov
  2024-03-05 17:41   ` Uwe Kleine-König
  2 siblings, 1 reply; 6+ messages in thread
From: Dmitry Torokhov @ 2024-03-05 17:15 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Krzysztof Kozlowski, Andy Shevchenko, linux-input,
	kernel

On Tue, Mar 05, 2024 at 11:10:42AM +0100, Uwe Kleine-König wrote:
> On a PC Engines APU our admins are faced with:
> 
> 	$ dmesg | grep -c "gpio-keys-polled gpio-keys-polled: unable to claim gpio 0, err=-517"
> 	261
> 
> Such a message always appears when e.g. a new USB device is plugged in.
> 
> Suppress this message which considerably clutters the kernel log for
> EPROBE_DEFER (i.e. -517).

I'll apply this, but that seems to be a misconfiguration somewhere - we
expect deferred probes to succeed eventually, here it looks like it
stays deferred forever and each time a new devices gets plugged in we
try to resolve deferred probe again and again.

Why doesn't gpio 0 become available?

Thanks.

-- 
Dmitry

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

* Re: [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio
  2024-03-05 17:15 ` Dmitry Torokhov
@ 2024-03-05 17:41   ` Uwe Kleine-König
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-03-05 17:41 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Linus Walleij, Andy Shevchenko, Krzysztof Kozlowski, kernel,
	linux-input

[-- Attachment #1: Type: text/plain, Size: 1478 bytes --]

On Tue, Mar 05, 2024 at 09:15:06AM -0800, Dmitry Torokhov wrote:
> On Tue, Mar 05, 2024 at 11:10:42AM +0100, Uwe Kleine-König wrote:
> > On a PC Engines APU our admins are faced with:
> > 
> > 	$ dmesg | grep -c "gpio-keys-polled gpio-keys-polled: unable to claim gpio 0, err=-517"
> > 	261
> > 
> > Such a message always appears when e.g. a new USB device is plugged in.
> > 
> > Suppress this message which considerably clutters the kernel log for
> > EPROBE_DEFER (i.e. -517).
> 
> I'll apply this, but that seems to be a misconfiguration somewhere - we
> expect deferred probes to succeed eventually, here it looks like it
> stays deferred forever and each time a new devices gets plugged in we
> try to resolve deferred probe again and again.
> 
> Why doesn't gpio 0 become available?

This is an x86 machine and I don't even know why the device actually
exists. Also I have no idea what gpio 0 should be, there seems to be a
gpio controller[1], but its GPIO numbers start at 512.

I found a bug report about this this issue:
https://github.com/pcengines/apu2-documentation/issues/204

Anyhow, I think my patch is fine. I forwarded the bug report to my admin
who might or might not dig deeper.

Best regards and thanks,
Uwe

[1] /sys/devices/pci0000:00/AMD0030:00/gpio/gpiochip512

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2024-03-05 17:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-05 10:10 [PATCH] Input: gpio_keys_polled - Suppress deferred probe error for gpio Uwe Kleine-König
2024-03-05 10:18 ` Linus Walleij
2024-03-05 17:01 ` Andy Shevchenko
2024-03-05 17:11   ` Dmitry Torokhov
2024-03-05 17:15 ` Dmitry Torokhov
2024-03-05 17:41   ` Uwe Kleine-König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.