Commit 302a085c authored by Kai-Heng Feng's avatar Kai-Heng Feng Committed by Pavel Machek

leds: core: Flush scheduled work for system suspend

Sometimes LED won't be turned off by LED_CORE_SUSPENDRESUME flag upon
system suspend.

led_set_brightness_nopm() uses schedule_work() to set LED brightness.
However, there's no guarantee that the scheduled work gets executed
because no one flushes the work.

So flush the scheduled work to make sure LED gets turned off.
Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
Fixes: 81fe8e5b ("leds: core: Add led_set_brightness_nosleep{nopm} functions")
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent 5ad79c20
......@@ -173,6 +173,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev)
{
led_cdev->flags |= LED_SUSPENDED;
led_set_brightness_nopm(led_cdev, 0);
flush_work(&led_cdev->set_brightness_work);
}
EXPORT_SYMBOL_GPL(led_classdev_suspend);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment