Re: [PATCH v3 1/4] leds: leds-pwm: Convert to use devm_get_pwm
From: Thierry Reding <hidden>
Date: 2012-12-11 07:03:31
Also in:
lkml
Attachments
- (unnamed) [application/pgp-signature] 836 bytes
From: Thierry Reding <hidden>
Date: 2012-12-11 07:03:31
Also in:
lkml
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 <redacted> --- 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. Thierry