[PATCH v3 1/4] leds: leds-pwm: Convert to use devm_get_pwm

Peter Ujfalusi peter.ujfalusi at ti.com
Tue Dec 11 19:29:21 EST 2012


On Tuesday 11 December 2012 08:03:07 Thierry Reding wrote:
> On Mon, Dec 10, 2012 at 11:00:34AM +0100, Peter Ujfalusi wrote:
> > Update the driver to use the new API for requesting pwm so we can take
> > advantage of the pwm_lookup table to find the correct pwm to be used for
> > the LED functionality.
> > If the devm_get_pwm fails we fall back to legacy mode to try to get the
> > pwm.
> > 
> > Signed-off-by: Peter Ujfalusi <peter.ujfalusi at ti.com>
> > ---
> > 
> >  drivers/leds/leds-pwm.c  | 19 ++++++-------------
> >  include/linux/leds_pwm.h |  2 +-
> >  2 files changed, 7 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
> > index 2157524..351257c 100644
> > --- a/drivers/leds/leds-pwm.c
> > +++ b/drivers/leds/leds-pwm.c
> > @@ -67,12 +67,11 @@ static int led_pwm_probe(struct platform_device *pdev)
> > 
> >  		cur_led = &pdata->leds[i];
> >  		led_dat = &leds_data[i];
> > 
> > -		led_dat->pwm = pwm_request(cur_led->pwm_id,
> > -				cur_led->name);
> > +		led_dat->pwm = devm_pwm_get(&pdev->dev, cur_led->name);
> > 
> >  		if (IS_ERR(led_dat->pwm)) {
> >  		
> >  			ret = PTR_ERR(led_dat->pwm);
> > 
> > -			dev_err(&pdev->dev, "unable to request PWM %d\n",
> > -					cur_led->pwm_id);
> > +			dev_err(&pdev->dev, "unable to request PWM for %s\n",
> > +				cur_led->name);
> > 
> >  			goto err;
> >  		
> >  		}
> 
> The commit message says that legacy mode is used as fallback if
> devm_get_pwm() (that should really be devm_pwm_get() btw) fails but I
> don't see where pwm_request() is called.

Oh, true. The fallback has been removed based on earlier comment from Bryan 
Wu. I will correct the commit message.

--
Péter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20121211/e3258b0a/attachment.html>


More information about the devicetree-discuss mailing list