[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a5a931e5-771d-3356-89c2-b0e49f74161c@gmail.com>
Date: Thu, 2 Jul 2020 22:50:58 +0200
From: Jacek Anaszewski <jacek.anaszewski@...il.com>
To: Kai-Heng Feng <kai.heng.feng@...onical.com>, pavel@....cz
Cc: anthony.wong@...onical.com, Dan Murphy <dmurphy@...com>,
"open list:LED SUBSYSTEM" <linux-leds@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] leds: core: Flush scheduled work for system suspend
Hi Kai-Heng,
Thank you for the update.
On 7/2/20 7:45 AM, Kai-Heng Feng wrote:
> 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@...onical.com>
> ---
> v2:
> - Use flush_work() instead.
>
> drivers/leds/led-class.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 3363a6551a70..cc3929f858b6 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -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);
>
>
Acked-by: Jacek Anaszewski <jacek.anaszewski@...il.com>
Pavel, this needs to go to stable as well, so let's add the tag:
Fixes: 81fe8e5b73e3 ("leds: core: Add led_set_brightness_nosleep{nopm}
functions")
--
Best regards,
Jacek Anaszewski
Powered by blists - more mailing lists