[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121211070307.GB8294@avionic-0098.adnet.avionic-design.de>
Date: Tue, 11 Dec 2012 08:03:07 +0100
From: Thierry Reding <thierry.reding@...onic-design.de>
To: Peter Ujfalusi <peter.ujfalusi@...com>
Cc: Bryan Wu <cooloney@...il.com>, Richard Purdie <rpurdie@...ys.net>,
Grant Likely <grant.likely@...retlab.ca>,
linux-kernel@...r.kernel.org, devicetree-discuss@...ts.ozlabs.org,
linux-doc@...r.kernel.org, linux-leds@...r.kernel.org
Subject: Re: [PATCH v3 1/4] leds: leds-pwm: Convert to use devm_get_pwm
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@...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.
Thierry
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists