leds: core: Flush scheduled work for system suspend
authorKai-Heng Feng <kai.heng.feng@canonical.com>
Thu, 2 Jul 2020 05:45:00 +0000 (13:45 +0800)
committerPavel Machek <pavel@ucw.cz>
Sun, 12 Jul 2020 08:10:37 +0000 (10:10 +0200)
commit302a085c20194bfa7df52e0fe684ee0c41da02e6
treed408d8ae7b85843fc4150f01fa3f68c393dcd61f
parent5ad79c20b6d28467db643ac107bbdaa01aa93a23
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: Kai-Heng Feng <kai.heng.feng@canonical.com>
Acked-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Fixes: 81fe8e5b73e3 ("leds: core: Add led_set_brightness_nosleep{nopm} functions")
Signed-off-by: Pavel Machek <pavel@ucw.cz>
drivers/leds/led-class.c