[PATCH 3/3] leds: leds-pwm: Defer led_pwm_set() if PWM can sleep

Peter Ujfalusi peter.ujfalusi at ti.com
Fri Jan 25 08:07:20 EST 2013


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



More information about the linux-arm-kernel mailing list