* [PATCH] leds: leds-gpio: Pass on error codes unmodified
@ 2015-02-01 3:15 Soren Brinkmann
2015-02-01 16:59 ` Sören Brinkmann
0 siblings, 1 reply; 3+ messages in thread
From: Soren Brinkmann @ 2015-02-01 3:15 UTC (permalink / raw)
To: Bryan Wu, Richard Purdie
Cc: linux-leds, linux-kernel, Michal Simek, Soren Brinkmann
Instead of overriding error codes, pass them on unmodified. This
way a EPROBE_DEFER is correctly passed to the driver core. This results
in the LED driver correctly requesting probe deferral in cases the GPIO
controller is not yet available.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
Adding pinctrl on Zynq shuffled with probing order quite a bit and a lot
of deferred probing is going on. With those changes I saw the LEDs
failing to probe due to the GPIO controller deferring probe until the
pincontroller is available. With this patch things work again:
dmesg | grep -i led:
of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/ds23[0]' - status (-517)
platform leds: Driver leds-gpio requests probe deferral
of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/ds23[0]' - status (0)
Soren
---
drivers/leds/leds-gpio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 7ea1ea42c2d2..d26af0a79a90 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -187,6 +187,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
led.gpiod = devm_get_gpiod_from_child(dev, child);
if (IS_ERR(led.gpiod)) {
fwnode_handle_put(child);
+ ret = PTR_ERR(led.gpiod);
goto err;
}
@@ -229,7 +230,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
err:
for (count = priv->num_leds - 2; count >= 0; count--)
delete_gpio_led(&priv->leds[count]);
- return ERR_PTR(-ENODEV);
+ return ERR_PTR(ret);
}
static const struct of_device_id of_gpio_leds_match[] = {
--
2.2.2.1.g63c5777
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: leds-gpio: Pass on error codes unmodified
2015-02-01 3:15 [PATCH] leds: leds-gpio: Pass on error codes unmodified Soren Brinkmann
@ 2015-02-01 16:59 ` Sören Brinkmann
2015-02-02 22:43 ` Bryan Wu
0 siblings, 1 reply; 3+ messages in thread
From: Sören Brinkmann @ 2015-02-01 16:59 UTC (permalink / raw)
To: Bryan Wu, Richard Purdie, Andreas Färber
Cc: linux-leds, linux-kernel, Michal Simek
+ Andreas who actually reported this issue and also tested the patch.
On Sat, 2015-01-31 at 07:15PM -0800, Soren Brinkmann wrote:
> Instead of overriding error codes, pass them on unmodified. This
> way a EPROBE_DEFER is correctly passed to the driver core. This results
> in the LED driver correctly requesting probe deferral in cases the GPIO
> controller is not yet available.
>
> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Here should be a:
Reported-and-tested-by: Andreas Färber <afaerber@suse.de>
> ---
> Adding pinctrl on Zynq shuffled with probing order quite a bit and a lot
> of deferred probing is going on. With those changes I saw the LEDs
> failing to probe due to the GPIO controller deferring probe until the
> pincontroller is available. With this patch things work again:
>
> dmesg | grep -i led:
> of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/ds23[0]' - status (-517)
> platform leds: Driver leds-gpio requests probe deferral
> of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/ds23[0]' - status (0)
>
> Soren
> ---
> drivers/leds/leds-gpio.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 7ea1ea42c2d2..d26af0a79a90 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -187,6 +187,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
> led.gpiod = devm_get_gpiod_from_child(dev, child);
> if (IS_ERR(led.gpiod)) {
> fwnode_handle_put(child);
> + ret = PTR_ERR(led.gpiod);
> goto err;
> }
>
> @@ -229,7 +230,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
> err:
> for (count = priv->num_leds - 2; count >= 0; count--)
> delete_gpio_led(&priv->leds[count]);
> - return ERR_PTR(-ENODEV);
> + return ERR_PTR(ret);
> }
>
> static const struct of_device_id of_gpio_leds_match[] = {
> --
> 2.2.2.1.g63c5777
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: leds-gpio: Pass on error codes unmodified
2015-02-01 16:59 ` Sören Brinkmann
@ 2015-02-02 22:43 ` Bryan Wu
0 siblings, 0 replies; 3+ messages in thread
From: Bryan Wu @ 2015-02-02 22:43 UTC (permalink / raw)
To: Sören Brinkmann
Cc: Richard Purdie, Andreas Färber, Linux LED Subsystem, lkml,
Michal Simek
On Sun, Feb 1, 2015 at 8:59 AM, Sören Brinkmann
<soren.brinkmann@xilinx.com> wrote:
> + Andreas who actually reported this issue and also tested the patch.
>
> On Sat, 2015-01-31 at 07:15PM -0800, Soren Brinkmann wrote:
>> Instead of overriding error codes, pass them on unmodified. This
>> way a EPROBE_DEFER is correctly passed to the driver core. This results
>> in the LED driver correctly requesting probe deferral in cases the GPIO
>> controller is not yet available.
>>
>> Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
>
> Here should be a:
> Reported-and-tested-by: Andreas Färber <afaerber@suse.de>
>
Good catch. I merged it to my tree.
Thanks,
-Bryan
>> ---
>> Adding pinctrl on Zynq shuffled with probing order quite a bit and a lot
>> of deferred probing is going on. With those changes I saw the LEDs
>> failing to probe due to the GPIO controller deferring probe until the
>> pincontroller is available. With this patch things work again:
>>
>> dmesg | grep -i led:
>> of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/ds23[0]' - status (-517)
>> platform leds: Driver leds-gpio requests probe deferral
>> of_get_named_gpiod_flags: parsed 'gpios' property of node '/leds/ds23[0]' - status (0)
>>
>> Soren
>> ---
>> drivers/leds/leds-gpio.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
>> index 7ea1ea42c2d2..d26af0a79a90 100644
>> --- a/drivers/leds/leds-gpio.c
>> +++ b/drivers/leds/leds-gpio.c
>> @@ -187,6 +187,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
>> led.gpiod = devm_get_gpiod_from_child(dev, child);
>> if (IS_ERR(led.gpiod)) {
>> fwnode_handle_put(child);
>> + ret = PTR_ERR(led.gpiod);
>> goto err;
>> }
>>
>> @@ -229,7 +230,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
>> err:
>> for (count = priv->num_leds - 2; count >= 0; count--)
>> delete_gpio_led(&priv->leds[count]);
>> - return ERR_PTR(-ENODEV);
>> + return ERR_PTR(ret);
>> }
>>
>> static const struct of_device_id of_gpio_leds_match[] = {
>> --
>> 2.2.2.1.g63c5777
>>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-02 22:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-01 3:15 [PATCH] leds: leds-gpio: Pass on error codes unmodified Soren Brinkmann
2015-02-01 16:59 ` Sören Brinkmann
2015-02-02 22:43 ` Bryan Wu
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).