From: peter.ujfalusi@ti.com (Peter Ujfalusi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] leds: leds-pwm: Defer led_pwm_set() if PWM can sleep
Date: Fri, 25 Jan 2013 14:07:20 +0100 [thread overview]
Message-ID: <51028388.3050903@ti.com> (raw)
In-Reply-To: <510282C9.5020509@epfl.ch>
On 01/25/2013 02:04 PM, Florian Vaussard wrote:
>>> @@ -153,6 +182,8 @@ static int led_pwm_probe(struct platform_device *pdev)
>>> led_dat->cdev.max_brightness = cur_led->max_brightness;
>>> led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>>>
>>> + INIT_WORK(&led_dat->work, led_pwm_work);
>>
>> If we query the can_sleep before we can skip the INIT_WORK() when it is not
>> set.
>>
>
> I will do like this.
On the other hand you should also check at remove time that you are not going
to cancel a work on a non initialized one.
>
>>> +
>>> ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
>>> if (ret < 0)
>>> goto err;
>>> @@ -180,8 +211,10 @@ static int led_pwm_remove(struct platform_device *pdev)
>>> struct led_pwm_priv *priv = platform_get_drvdata(pdev);
>>> int i;
>>>
>>> - for (i = 0; i < priv->num_leds; i++)
>>> + for (i = 0; i < priv->num_leds; i++) {
>>> led_classdev_unregister(&priv->leds[i].cdev);
>>> + cancel_work_sync(&priv->leds[i].work);
>>> + }
>>>
>>> return 0;
>>> }
>>>
>>
>>
>
> Thank you,
>
> Florian
--
P?ter
WARNING: multiple messages have this Message-ID (diff)
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: <florian.vaussard@epfl.ch>
Cc: Bryan Wu <cooloney@gmail.com>, Richard Purdie <rpurdie@rpsys.net>,
Thierry Reding <thierry.reding@avionic-design.de>,
<linux-leds@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] leds: leds-pwm: Defer led_pwm_set() if PWM can sleep
Date: Fri, 25 Jan 2013 14:07:20 +0100 [thread overview]
Message-ID: <51028388.3050903@ti.com> (raw)
In-Reply-To: <510282C9.5020509@epfl.ch>
On 01/25/2013 02:04 PM, Florian Vaussard wrote:
>>> @@ -153,6 +182,8 @@ static int led_pwm_probe(struct platform_device *pdev)
>>> led_dat->cdev.max_brightness = cur_led->max_brightness;
>>> led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME;
>>>
>>> + INIT_WORK(&led_dat->work, led_pwm_work);
>>
>> If we query the can_sleep before we can skip the INIT_WORK() when it is not
>> set.
>>
>
> I will do like this.
On the other hand you should also check at remove time that you are not going
to cancel a work on a non initialized one.
>
>>> +
>>> ret = led_classdev_register(&pdev->dev, &led_dat->cdev);
>>> if (ret < 0)
>>> goto err;
>>> @@ -180,8 +211,10 @@ static int led_pwm_remove(struct platform_device *pdev)
>>> struct led_pwm_priv *priv = platform_get_drvdata(pdev);
>>> int i;
>>>
>>> - for (i = 0; i < priv->num_leds; i++)
>>> + for (i = 0; i < priv->num_leds; i++) {
>>> led_classdev_unregister(&priv->leds[i].cdev);
>>> + cancel_work_sync(&priv->leds[i].work);
>>> + }
>>>
>>> return 0;
>>> }
>>>
>>
>>
>
> Thank you,
>
> Florian
--
Péter
next prev parent reply other threads:[~2013-01-25 13:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-25 10:01 [PATCH 0/3] leds-pwm: Defer PWM calls if PWM can sleep Florian Vaussard
2013-01-25 10:01 ` Florian Vaussard
2013-01-25 10:01 ` [PATCH 1/3] pwm: Add pwm_cansleep() as exported API to users Florian Vaussard
2013-01-25 10:01 ` Florian Vaussard
2013-01-25 12:32 ` Peter Ujfalusi
2013-01-25 12:32 ` Peter Ujfalusi
2013-01-25 12:34 ` Florian Vaussard
2013-01-25 12:34 ` Florian Vaussard
2013-01-25 10:01 ` [PATCH 2/3] pwm: Add can_sleep property to drivers Florian Vaussard
2013-01-25 10:01 ` Florian Vaussard
2013-01-25 10:01 ` [PATCH 3/3] leds: leds-pwm: Defer led_pwm_set() if PWM can sleep Florian Vaussard
2013-01-25 10:01 ` Florian Vaussard
2013-01-25 12:53 ` Peter Ujfalusi
2013-01-25 12:53 ` Peter Ujfalusi
2013-01-25 13:04 ` Florian Vaussard
2013-01-25 13:04 ` Florian Vaussard
2013-01-25 13:07 ` Peter Ujfalusi [this message]
2013-01-25 13:07 ` Peter Ujfalusi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51028388.3050903@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.