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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux