* [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
@ 2023-12-02 18:36 Stefan Wahren
2023-12-04 10:21 ` Linus Walleij
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Stefan Wahren @ 2023-12-02 18:36 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, Pavel Machek, Lee Jones
Cc: Andy Shevchenko, linux-leds, Stefan Wahren
In case leds-gpio fails to get at least one of possibly many GPIOs
from the DT (e.g. the GPIO is already requested) neither gpiolib nor
the driver does provide any helpful error log:
leds-gpio: probe of leds failed with error -16
As the driver knows better how to handle errors with such mandatory
GPIOs, let's implement an error log which points to the affected
GPIO.
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
Previous discussion:
https://lore.kernel.org/linux-leds/20231201112330.GD3259151@google.com/T/
Changes in V3:
- drop already applied patch from series
- s/gpio/GPIO/ as suggested by Lee Jones
- improve commit message
Changes in V2:
- replace dev_err with dev_err_probe to handle EPROBE_DEFER properly
drivers/leds/leds-gpio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 710c319ad312..83fcd7b6afff 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -172,6 +172,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct device *dev)
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS,
NULL);
if (IS_ERR(led.gpiod)) {
+ dev_err_probe(dev, PTR_ERR(led.gpiod), "Failed to get GPIO '%pfw'\n",
+ child);
fwnode_handle_put(child);
return ERR_CAST(led.gpiod);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
2023-12-02 18:36 [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails Stefan Wahren
@ 2023-12-04 10:21 ` Linus Walleij
2023-12-04 14:03 ` Andy Shevchenko
2023-12-07 16:08 ` (subset) " Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2023-12-04 10:21 UTC (permalink / raw)
To: Stefan Wahren
Cc: Bartosz Golaszewski, Pavel Machek, Lee Jones, Andy Shevchenko,
linux-leds
On Sat, Dec 2, 2023 at 7:37 PM Stefan Wahren <wahrenst@gmx.net> wrote:
> In case leds-gpio fails to get at least one of possibly many GPIOs
> from the DT (e.g. the GPIO is already requested) neither gpiolib nor
> the driver does provide any helpful error log:
>
> leds-gpio: probe of leds failed with error -16
>
> As the driver knows better how to handle errors with such mandatory
> GPIOs, let's implement an error log which points to the affected
> GPIO.
>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
2023-12-02 18:36 [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails Stefan Wahren
2023-12-04 10:21 ` Linus Walleij
@ 2023-12-04 14:03 ` Andy Shevchenko
2023-12-07 16:08 ` (subset) " Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-12-04 14:03 UTC (permalink / raw)
To: Stefan Wahren
Cc: Bartosz Golaszewski, Linus Walleij, Pavel Machek, Lee Jones,
linux-leds
On Sat, Dec 02, 2023 at 07:36:36PM +0100, Stefan Wahren wrote:
> In case leds-gpio fails to get at least one of possibly many GPIOs
> from the DT (e.g. the GPIO is already requested) neither gpiolib nor
> the driver does provide any helpful error log:
>
> leds-gpio: probe of leds failed with error -16
>
> As the driver knows better how to handle errors with such mandatory
> GPIOs, let's implement an error log which points to the affected
> GPIO.
As we have had a consensus,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: (subset) [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
2023-12-02 18:36 [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails Stefan Wahren
2023-12-04 10:21 ` Linus Walleij
2023-12-04 14:03 ` Andy Shevchenko
@ 2023-12-07 16:08 ` Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2023-12-07 16:08 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, Pavel Machek, Lee Jones,
Stefan Wahren
Cc: Andy Shevchenko, linux-leds
On Sat, 02 Dec 2023 19:36:36 +0100, Stefan Wahren wrote:
> In case leds-gpio fails to get at least one of possibly many GPIOs
> from the DT (e.g. the GPIO is already requested) neither gpiolib nor
> the driver does provide any helpful error log:
>
> leds-gpio: probe of leds failed with error -16
>
> As the driver knows better how to handle errors with such mandatory
> GPIOs, let's implement an error log which points to the affected
> GPIO.
>
> [...]
Applied, thanks!
[1/1] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
commit: 430545cd13d0f554aaadb8b938ac0bdf7a70a413
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-12-07 16:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-02 18:36 [PATCH V3] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails Stefan Wahren
2023-12-04 10:21 ` Linus Walleij
2023-12-04 14:03 ` Andy Shevchenko
2023-12-07 16:08 ` (subset) " Lee Jones
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.