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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to