Re: [PATCH] backlight: pwm: handle EPROBE_DEFER while requesting the PWM

From: Lee Jones
Date: Thu Mar 12 2015 - 02:59:25 EST


On Thu, 19 Feb 2015, Nicolas Ferre wrote:

> When trying to request the PWM device with devm_pwm_get(), the EPROBE_DEFER
> flag is not handled properly. It can lead to the PWM not being found.
>
> Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@xxxxxxxxx>
> ---
> drivers/video/backlight/pwm_bl.c | 4 ++++
> 1 file changed, 4 insertions(+)

I need a Thierry Ack for this.

> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 3a145a643e0d..6897f1c1bc73 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -274,6 +274,10 @@ static int pwm_backlight_probe(struct platform_device *pdev)
>
> pb->pwm = devm_pwm_get(&pdev->dev, NULL);
> if (IS_ERR(pb->pwm)) {
> + ret = PTR_ERR(pb->pwm);
> + if (ret == -EPROBE_DEFER)
> + goto err_alloc;
> +
> dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
> pb->legacy = true;
> pb->pwm = pwm_request(data->pwm_id, "pwm-backlight");

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/