ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
Subsystems (4)
v2 cover ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
This series fixes the probing of leds-gpio on the Raspberry Pi 400. Also try to improve the error logging of leds-gpio.
Changes in V2:
- replace dev_err with dev_err_probe in patch 1 to handle EPROBE_DEFER properly
Stefan Wahren (2):
leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts | 4 +--- drivers/leds/leds-gpio.c | 2 ++ 2 files changed, 3 insertions(+), 3 deletions(-)
--
2.34.1
PATCH v2 1/2 leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case devm_fwnode_gpiod_get() fails.
--- drivers/leds/leds-gpio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/leds/leds-gpio.c +2 -0
@@ -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
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Quoted 6 lines · Stefan Wahren
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails.
...
drivers/leds/leds-gpio.c static struct gpio_leds_priv *gpio_leds_create(struct device *dev) · line 179
Quoted 8 lines
drivers/leds/leds-gpio.c +2
-0led.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); }
Thinking more about it. GPIO library already issues bunch of messages.
"using DT ... for ... GPIO lookup"
"using lookup tables for GPIO lookup"
"No GPIO consumer ... found"
Isn't it enough?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Hi Andy,
[add Linus and Bartosz]
Am 20.11.23 um 12:47 schrieb Andy Shevchenko:
Quoted 19 lines · Stefan Wahren
Quoted 6 lines
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails....
drivers/leds/leds-gpio.c static struct gpio_leds_priv *gpio_leds_create(struct device *dev) · line 179
Quoted 8 lines
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL,
GPIOD_ASIS,
NULL);
if (IS_ERR(led.gpiod)) {drivers/leds/leds-gpio.c +2
-0+dev_err_probe (dev,PTR_ERR (led.gpiod),"Failed to get gpio '%pfw'\n" , + child);fwnode_handle_put (child);return ERR_CAST (led.gpiod); }Thinking more about it. GPIO library already issues bunch of messages.
Quoted 3 lines
"using DT ... for ... GPIO lookup"
"using lookup tables for GPIO lookup"
"No GPIO consumer ... found"
are these errors or debug messages?
I cannot remember that i saw any of them on info level in my case of an already allocated pin (see patch 2).
I'm open to place the log within gpiolib, if this a better place.
Best regards
Quoted 3 lines
Isn't it enough?
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Quoted 8 lines · Stefan Wahren
Am 20.11.23 um 12:47 schrieb Andy Shevchenko:
Quoted 7 lines · Stefan Wahren
Quoted 6 lines
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails.
...
Quoted 10 lines
Quoted 10 lines
drivers/leds/leds-gpio.c static struct gpio_leds_priv *gpio_leds_create(struct device *dev) · line 179
Quoted 8 lines
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL,
GPIOD_ASIS,
NULL);
if (IS_ERR(led.gpiod)) {drivers/leds/leds-gpio.c +2
-0+dev_err_probe (dev,PTR_ERR (led.gpiod),"Failed to get gpio '%pfw'\n" , + child);fwnode_handle_put (child);return ERR_CAST (led.gpiod); }Thinking more about it. GPIO library already issues bunch of messages.
Quoted 4 lines
Quoted 3 lines
"using DT ... for ... GPIO lookup"
"using lookup tables for GPIO lookup"
"No GPIO consumer ... found"are these errors or debug messages?
Indeed they are on debug level.
Quoted 4 lines
I cannot remember that i saw any of them on info level in my case of an already allocated pin (see patch 2).
I'm open to place the log within gpiolib, if this a better place.
I'm not sure, let's hear GPIO maintainers for that.
Quoted 1 line
Quoted 1 line
Isn't it enough?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Quoted 28 lines · Andy Shevchenko
Quoted 8 lines · Stefan Wahren
Am 20.11.23 um 12:47 schrieb Andy Shevchenko:
Quoted 7 lines · Stefan Wahren
Quoted 6 lines
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails....
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS, NULL); if (IS_ERR(led.gpiod)) {drivers/leds/leds-gpio.c +2
-0+dev_err_probe (dev,PTR_ERR (led.gpiod),"Failed to get gpio '%pfw'\n" , + child);fwnode_handle_put (child);return ERR_CAST (led.gpiod); }Quoted 6 lines
Quoted 5 lines
Thinking more about it. GPIO library already issues bunch of messages.
"using DT ... for ... GPIO lookup"
"using lookup tables for GPIO lookup"
"No GPIO consumer ... found"are these errors or debug messages?
Quoted 9 lines
Indeed they are on debug level.
Quoted 4 lines
I cannot remember that i saw any of them on info level in my case of an already allocated pin (see patch 2).
I'm open to place the log within gpiolib, if this a better place.
I'm not sure, let's hear GPIO maintainers for that.
Hard to tell which method is preferred among all the subsystems. Personally I'm more inclined towards letting drivers decide whether to emit an error message and only emit our own when an error cannot be propagated down the stack.
Linus: Any thoughts?
Bart
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Isn't it enough?
--
With Best Regards,
Andy Shevchenko
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Am 22.11.23 um 11:52 schrieb Bartosz Golaszewski:
Quoted 33 lines
Quoted 31 lines · Andy Shevchenko
Quoted 8 lines · Stefan Wahren
Am 20.11.23 um 12:47 schrieb Andy Shevchenko:
Quoted 7 lines · Stefan Wahren
Quoted 6 lines
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails....
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
led.gpiod = devm_fwnode_gpiod_get(dev, child, NULL, GPIOD_ASIS, NULL); if (IS_ERR(led.gpiod)) {drivers/leds/leds-gpio.c +2
-0+dev_err_probe (dev,PTR_ERR (led.gpiod),"Failed to get gpio '%pfw'\n" , + child);fwnode_handle_put (child);return ERR_CAST (led.gpiod); }Quoted 6 lines
Quoted 5 lines
Thinking more about it. GPIO library already issues bunch of messages.
"using DT ... for ... GPIO lookup"
"using lookup tables for GPIO lookup"
"No GPIO consumer ... found"are these errors or debug messages?
Indeed they are on debug level.
Quoted 4 lines
I cannot remember that i saw any of them on info level in my case of an already allocated pin (see patch 2).
I'm open to place the log within gpiolib, if this a better place.
Quoted 8 lines
Quoted 2 lines
I'm not sure, let's hear GPIO maintainers for that.
Hard to tell which method is preferred among all the subsystems. Personally I'm more inclined towards letting drivers decide whether to emit an error message and only emit our own when an error cannot be propagated down the stack.
Linus: Any thoughts?
gentle ping ...
Quoted 13 lines
Bart
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Isn't it enough?
--
With Best Regards,
Andy Shevchenko_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
In reply to Bartosz GolaszewskiQuoted 5 lines · Bartosz Golaszewski
Quoted 5 lines
Quoted 4 lines
I cannot remember that i saw any of them on info level in my case of an already allocated pin (see patch 2).
I'm open to place the log within gpiolib, if this a better place.
Quoted 8 lines
Quoted 1 line
I'm not sure, let's hear GPIO maintainers for that.
Hard to tell which method is preferred among all the subsystems. Personally I'm more inclined towards letting drivers decide whether to emit an error message and only emit our own when an error cannot be propagated down the stack.
Linus: Any thoughts?
I never managed to get it right so I can't give any good advice.
Usually I tend to think better one more error message than one too little.
Then again I'm a dmesg maximalist who just want it to scroll on forever also with positive messages...
Yours,
Linus Walleij
Re: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
Am 29.11.23 um 15:03 schrieb Linus Walleij:
Quoted 12 lines · Bartosz Golaszewski
Quoted 11 lines
Quoted 6 lines
Quoted 5 lines
I cannot remember that i saw any of them on info level in my case of an already allocated pin (see patch 2).
I'm open to place the log within gpiolib, if this a better place.
I'm not sure, let's hear GPIO maintainers for that.
Hard to tell which method is preferred among all the subsystems. Personally I'm more inclined towards letting drivers decide whether to emit an error message and only emit our own when an error cannot be propagated down the stack.
Quoted 7 lines
Quoted 1 line
Linus: Any thoughts?
I never managed to get it right so I can't give any good advice.
Usually I tend to think better one more error message than one too little.
Then again I'm a dmesg maximalist who just want it to scroll on forever also with positive messages...
Okay, based on the feedback this sounds like nobody is against this patch?
Quoted 8 lines
Yours,
Linus Walleij_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Lee Jones
maintainerRe: [PATCH V2 1/2] leds: gpio: Add kernel log if devm_fwnode_gpiod_get fails
In reply to Stefan WahrenQuoted 17 lines · Stefan Wahren
In case leds-gpio fails to get the GPIO from the DT (e.g. the GPIO is already requested) the driver doesn't provide any helpful error log:
leds-gpio: probe of leds failed with error -16
So add a new error log in case
devm_fwnode_gpiod_get()fails.Signed-off-by Stefan Wahren <[email protected]>--- drivers/leds/leds-gpio.c | 2 ++ 1 file changed, 2 insertions(+)drivers/leds/leds-gpio.c +0
-0
drivers/leds/leds-gpio.c static struct gpio_leds_priv *gpio_leds_create(struct device *dev) · line 175
Quoted 4 lines
drivers/leds/leds-gpio.c +1
-0@@ -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",
Nit: GPIO
Quoted 7 lines
drivers/leds/leds-gpio.c +1
-1+ child);fwnode_handle_put (child);return ERR_CAST (led.gpiod); } --2.34.1
Signature · 1 line
Lee Jones [李琼斯]
PATCH v2 2/2 ARM: dts: bcm2711-rpi-400: Fix delete-node of led_act
In reply to Stefan WahrenThe LED ACT which is included from bcm2711-rpi-4-b doesn't exists on the Raspberry Pi 400. So the bcm2711-rpi-400.dts tries to use the delete-node directive in order to remove the complete node. Unfortunately the usage get broken in commit 1156e3a78bcc ("ARM: dts: bcm283x: Move ACT LED into separate dtsi") and now ACT and PWR LED using the same GPIO and this prevent probing of led-gpios on Raspberry Pi 400:
leds-gpio: probe of leds failed with error -16
So fix the delete-node directive.
--- arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts +1 -3
@@ -36,9 +36,7 @@ &led_pwr { gpios = <&gpio 42 GPIO_ACTIVE_HIGH>; }; -&leds { - /delete-node/ led_act; -}; +/delete-node/ &led_act; &pm { /delete-property/ system-power-controller;
--
2.34.1
From: Florian Fainelli <[email protected]>
Quoted 8 lines · Stefan Wahren
The LED ACT which is included from bcm2711-rpi-4-b doesn't exists on the Raspberry Pi 400. So the
bcm2711-rpi-400.dtstries to use the delete-node directive in order to remove the complete node. Unfortunately the usage get broken in commit1156e3a78bcc("ARM: dts: bcm283x: Move ACT LED into separate dtsi") and now ACT and PWR LED using the same GPIO and this prevent probing of led-gpios on Raspberry Pi 400:
Quoted 7 lines
leds-gpio: probe of leds failed with error -16
So fix the delete-node directive.
Fixes 1156e3a78bcc ("ARM: dts: bcm283x: Move ACT LED into separate dtsi")Signed-off-by Stefan Wahren <[email protected]>---
Applied to https://github.com/Broadcom/stblinux/commits/devicetree/fixes, thanks! --
Florian
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel