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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:53 +0000 (08:23 +0200)
commit087f3e8f75779bbb402615a95b79efaa43c81872
tree6aed68f7c8e684659374c187e257f92746105821
parentb67ed111a37880e1bcfca93da41e2a0afba37d49
leds: core: Flush scheduled work for system suspend

[ Upstream commit 302a085c20194bfa7df52e0fe684ee0c41da02e6 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/leds/led-class.c