Skip to content

Commit 92887e8

Browse files
Kai-Heng Fenggregkh
authored andcommitted
leds: core: Flush scheduled work for system suspend
[ Upstream commit 302a085 ] 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: Kai-Heng Feng <kai.heng.feng@canonical.com> Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com> Fixes: 81fe8e5 ("leds: core: Add led_set_brightness_nosleep{nopm} functions") Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent adf0cae commit 92887e8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/leds/led-class.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ void led_classdev_suspend(struct led_classdev *led_cdev)
173173
{
174174
led_cdev->flags |= LED_SUSPENDED;
175175
led_set_brightness_nopm(led_cdev, 0);
176+
flush_work(&led_cdev->set_brightness_work);
176177
}
177178
EXPORT_SYMBOL_GPL(led_classdev_suspend);
178179

0 commit comments

Comments
 (0)