diff mbox

backlight: pwm: handle EPROBE_DEFER while requesting the PWM

Message ID 1424338214-24236-1-git-send-email-nicolas.ferre@atmel.com
State Accepted
Headers show

Commit Message

Nicolas Ferre Feb. 19, 2015, 9:30 a.m. UTC
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@free-electrons.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/video/backlight/pwm_bl.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Nicolas Ferre March 11, 2015, 12:48 p.m. UTC | #1
Le 19/02/2015 10:30, Nicolas Ferre a écrit :
> 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@free-electrons.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Any comment on this patch?
Can we see it included during next cycle (4.1)?

(aka ping).

Bye,


> ---
>  drivers/video/backlight/pwm_bl.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> 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 March 12, 2015, 6:59 a.m. UTC | #2
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@free-electrons.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  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");
Thierry Reding March 12, 2015, 7:49 a.m. UTC | #3
On Thu, Feb 19, 2015 at 10:30:14AM +0100, 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@free-electrons.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/video/backlight/pwm_bl.c | 4 ++++
>  1 file changed, 4 insertions(+)

Acked-by: Thierry Reding <thierry.reding@gmail.com>
Lee Jones March 12, 2015, 9:02 a.m. UTC | #4
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@free-electrons.com>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
>  drivers/video/backlight/pwm_bl.c | 4 ++++
>  1 file changed, 4 insertions(+)

Applied, thanks.

> 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");
Boris Brezillon May 25, 2015, 9:27 a.m. UTC | #5
Hi Lee,

On Thu, 12 Mar 2015 09:02:24 +0000
Lee Jones <lee.jones@linaro.org> wrote:

> 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@free-electrons.com>
> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> > ---
> >  drivers/video/backlight/pwm_bl.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> 
> Applied, thanks.

I don't see this patch in Linus' tree (actually, it's not even in
linux-next).
I don't know where it's stuck, but could you make sure it reaches
mainline for 4.2 (or 4.1 if it's not to late) ?

Best Regards,

Boris
Lee Jones May 26, 2015, 7:36 a.m. UTC | #6
Stephen, Boris,

> > > 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@free-electrons.com>
> > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> > > ---
> > >  drivers/video/backlight/pwm_bl.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > 
> > Applied, thanks.
> 
> I don't see this patch in Linus' tree (actually, it's not even in
> linux-next).
> I don't know where it's stuck, but could you make sure it reaches
> mainline for 4.2 (or 4.1 if it's not to late) ?

Sorry for the confusion.

It looks like my for-backlight-fixes branch isn't in -next.

Stephen, could you rectify that please?

M: git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git
Stephen Rothwell May 26, 2015, 9:20 p.m. UTC | #7
Hi Lee,

On Tue, 26 May 2015 08:36:48 +0100 Lee Jones <lee.jones@linaro.org> wrote:
>
> It looks like my for-backlight-fixes branch isn't in -next.
> 
> Stephen, could you rectify that please?
> 
> M: git://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git

Added from today.

Thanks for adding your subsystem tree as a participant of linux-next.  As
you may know, this is not a judgment of your code.  The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window. 

You will need to ensure that the patches/commits in your tree/series have
been:
     * submitted under GPL v2 (or later) and include the Contributor's
        Signed-off-by,
     * posted to the relevant mailing list,
     * reviewed by you (or another maintainer of your subsystem tree),
     * successfully unit tested, and 
     * destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him
to fetch).  It is allowed to be rebased if you deem it necessary.
diff mbox

Patch

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");