# \[PATCH\] pwm-backlight: Use devm\_pwm\_get in pwm\_bl.c

- Subsystems: FRAMEBUFFER LAYER, BACKLIGHT CLASS/SUBSYSTEM, THE REST
- Maintainers: Helge Deller, Lee Jones, Daniel Thompson, Jingoo Han, Linus Torvalds
- List: linux-fbdev
- 5 messages, 3 authors
- Page: https://ratatoskr.run/linux-fbdev/2012/09/13463853/t

## \[PATCH\] pwm-backlight: Use devm\_pwm\_get in pwm\_bl.c

- From: Sachin Kamat \<hidden\>
- Date: 2012-09-11 08:54:29 
- Message: https://ratatoskr.run/linux-fbdev/2012/09/13463853.md

```text
This file already makes use of device managed functions.
Convert pwm_get() too to use it.

Signed-off-by: Sachin Kamat <redacted>
---
 drivers/video/backlight/pwm_bl.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 4965408..0c91023 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -218,7 +218,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	pb->exit = data->exit;
 	pb->dev = &pdev->dev;
 
-	pb->pwm = pwm_get(&pdev->dev, NULL);
+	pb->pwm = devm_pwm_get(&pdev->dev, NULL);
 	if (IS_ERR(pb->pwm)) {
 		dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
 
@@ -251,7 +251,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	if (IS_ERR(bl)) {
 		dev_err(&pdev->dev, "failed to register backlight\n");
 		ret = PTR_ERR(bl);
-		goto err_bl;
+		goto err_alloc;
 	}
 
 	bl->props.brightness = data->dft_brightness;
@@ -260,8 +260,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, bl);
 	return 0;
 
-err_bl:
-	pwm_put(pb->pwm);
 err_alloc:
 	if (data->exit)
 		data->exit(&pdev->dev);
@@ -276,7 +274,6 @@ static int pwm_backlight_remove(struct platform_device *pdev)
 	backlight_device_unregister(bl);
 	pwm_config(pb->pwm, 0, pb->period);
 	pwm_disable(pb->pwm);
-	pwm_put(pb->pwm);
 	if (pb->exit)
 		pb->exit(&pdev->dev);
 	return 0;
-- 
1.7.4.1

```

## RE: \[PATCH\] pwm-backlight: Use devm\_pwm\_get in pwm\_bl.c

- From: Jingoo Han \<hidden\>
- Date: 2012-09-12 00:55:48 
- Message: https://ratatoskr.run/linux-fbdev/2012/09/13463854.md

```text
On Tuesday, September 11, 2012 5:42 PM Sachin Kamat wrote
> 
> This file already makes use of device managed functions.
> Convert pwm_get() too to use it.
> 
> Signed-off-by: Sachin Kamat <redacted>

CC'ed Thierry Reding.

Acked-by: Jingoo Han <redacted>


> ---
>  drivers/video/backlight/pwm_bl.c |    7 ++-----
>  1 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 4965408..0c91023 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -218,7 +218,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
>  	pb->exit = data->exit;
>  	pb->dev = &pdev->dev;
> 
> -	pb->pwm = pwm_get(&pdev->dev, NULL);
> +	pb->pwm = devm_pwm_get(&pdev->dev, NULL);
>  	if (IS_ERR(pb->pwm)) {
>  		dev_err(&pdev->dev, "unable to request PWM, trying legacy API\n");
> 
> @@ -251,7 +251,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
>  	if (IS_ERR(bl)) {
>  		dev_err(&pdev->dev, "failed to register backlight\n");
>  		ret = PTR_ERR(bl);
> -		goto err_bl;
> +		goto err_alloc;
>  	}
> 
>  	bl->props.brightness = data->dft_brightness;
> @@ -260,8 +260,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, bl);
>  	return 0;
> 
> -err_bl:
> -	pwm_put(pb->pwm);
>  err_alloc:
>  	if (data->exit)
>  		data->exit(&pdev->dev);
> @@ -276,7 +274,6 @@ static int pwm_backlight_remove(struct platform_device *pdev)
>  	backlight_device_unregister(bl);
>  	pwm_config(pb->pwm, 0, pb->period);
>  	pwm_disable(pb->pwm);
> -	pwm_put(pb->pwm);
>  	if (pb->exit)
>  		pb->exit(&pdev->dev);
>  	return 0;
> --
> 1.7.4.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Re: \[PATCH\] pwm-backlight: Use devm\_pwm\_get in pwm\_bl.c

- From: Thierry Reding \<hidden\>
- Date: 2012-09-17 06:04:44 
- Message: https://ratatoskr.run/linux-fbdev/2012/09/13463855.md

```text
On Wed, Sep 12, 2012 at 09:55:48AM +0900, Jingoo Han wrote:
> On Tuesday, September 11, 2012 5:42 PM Sachin Kamat wrote
> > 
> > This file already makes use of device managed functions.
> > Convert pwm_get() too to use it.
> > 
> > Signed-off-by: Sachin Kamat <redacted>
> 
> CC'ed Thierry Reding.
> 
> Acked-by: Jingoo Han <redacted>

Hi Sachin,

As discussed elsewhere I'm taking over maintenance of the pwm-backlight
driver as part of the PWM subsystem. I hadn't been Cc'ed on your first
send and I'm not subscribed to linux-fbdev so I didn't receive a copy of
the patch.

Thanks,
Thierry
```

## Re: \[PATCH\] pwm-backlight: Use devm\_pwm\_get in pwm\_bl.c

- From: Thierry Reding \<hidden\>
- Date: 2012-09-17 06:16:29 
- Message: https://ratatoskr.run/linux-fbdev/2012/09/13463856.md

```text
On Mon, Sep 17, 2012 at 11:43:11AM +0530, Sachin Kamat wrote:
> Hi Thierry,
> 
> On 17 September 2012 11:34, Thierry Reding
> [ref] wrote:
> > On Wed, Sep 12, 2012 at 09:55:48AM +0900, Jingoo Han wrote:
> >> On Tuesday, September 11, 2012 5:42 PM Sachin Kamat wrote
> >> >
> >> > This file already makes use of device managed functions.
> >> > Convert pwm_get() too to use it.
> >> >
> >> > Signed-off-by: Sachin Kamat <redacted>
> >>
> >> CC'ed Thierry Reding.
> >>
> >> Acked-by: Jingoo Han <redacted>
> >
> > Hi Sachin,
> >
> > As discussed elsewhere I'm taking over maintenance of the pwm-backlight
> > driver as part of the PWM subsystem.
> 
> That is really nice :)
> 
>  I hadn't been Cc'ed on your first
> > send and I'm not subscribed to linux-fbdev so I didn't receive a copy of
> > the patch.
> 
> Yes. I obtained the list from get_maintainers.pl, so missed out CCing you.
> I will re-send the patch with you in CC now.

Yes, I've contacted Richard to get his approval as the backlight
subsystem maintainer. If he's okay I'll send a patch shortly to add the
corresponding files to MAINTAINERS so that next time I'll wind up in
that list.

Thierry
```

## Re: \[PATCH\] pwm-backlight: Use devm\_pwm\_get in pwm\_bl.c

- From: Sachin Kamat \<hidden\>
- Date: 2012-09-17 06:25:11 
- Message: https://ratatoskr.run/linux-fbdev/2012/09/13463857.md

```text
Hi Thierry,

On 17 September 2012 11:34, Thierry Reding
[ref] wrote:
> On Wed, Sep 12, 2012 at 09:55:48AM +0900, Jingoo Han wrote:
>> On Tuesday, September 11, 2012 5:42 PM Sachin Kamat wrote
>> >
>> > This file already makes use of device managed functions.
>> > Convert pwm_get() too to use it.
>> >
>> > Signed-off-by: Sachin Kamat <redacted>
>>
>> CC'ed Thierry Reding.
>>
>> Acked-by: Jingoo Han <redacted>
>
> Hi Sachin,
>
> As discussed elsewhere I'm taking over maintenance of the pwm-backlight
> driver as part of the PWM subsystem.

That is really nice :)

 I hadn't been Cc'ed on your first
> send and I'm not subscribed to linux-fbdev so I didn't receive a copy of
> the patch.

Yes. I obtained the list from get_maintainers.pl, so missed out CCing you.
I will re-send the patch with you in CC now.


>
> Thanks,
> Thierry



-- 
With warm regards,
Sachin
```
