public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>, pavel@ucw.cz
Cc: anthony.wong@canonical.com, Dan Murphy <dmurphy@ti.com>,
	"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] leds: core: Flush scheduled work for system suspend
Date: Thu, 2 Jul 2020 22:50:58 +0200	[thread overview]
Message-ID: <a5a931e5-771d-3356-89c2-b0e49f74161c@gmail.com> (raw)
In-Reply-To: <20200702054500.11251-1-kai.heng.feng@canonical.com>

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@canonical.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@gmail.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

  reply	other threads:[~2020-07-02 20:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02  5:45 [PATCH v2] leds: core: Flush scheduled work for system suspend Kai-Heng Feng
2020-07-02 20:50 ` Jacek Anaszewski [this message]
2020-07-12  8:13   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5a931e5-771d-3356-89c2-b0e49f74161c@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=anthony.wong@canonical.com \
    --cc=dmurphy@ti.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox