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] leds: core: Use blocking op for system suspend
Date: Wed, 1 Jul 2020 23:28:29 +0200 [thread overview]
Message-ID: <38622f5a-4518-cdb4-d1ca-581f470ce797@gmail.com> (raw)
In-Reply-To: <20200701093541.14191-1-kai.heng.feng@canonical.com>
Hi Kai-Heng,
Thank you for the patch.
On 7/1/20 11:35 AM, Kai-Heng Feng wrote:
> Sometimes LED won't be turned off by LED_CORE_SUSPENDRESUME flag upon
> system suspend.
Just out of curiosity - are you experiencing that on some hardware?
> 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 calls flush_scheduled_work().
>
> As flush_scheduled_work() may affect other drivers' suspend routines,
> take a more contained approach which uses blocking op to make sure the
> LED gets turned off.
>
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
> drivers/leds/led-core.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
> index f1f718dbe0f8..9a5bfcd7a704 100644
> --- a/drivers/leds/led-core.c
> +++ b/drivers/leds/led-core.c
> @@ -269,6 +269,11 @@ EXPORT_SYMBOL_GPL(led_set_brightness);
> void led_set_brightness_nopm(struct led_classdev *led_cdev,
> enum led_brightness value)
> {
> +
> + if (led_cdev->flags & LED_SUSPENDED &&
> + !__led_set_brightness_blocking(led_cdev, value))
> + return;
> +
This function is "nopm" for a reason - we do not make here any
pm management related operations.
Instead of that, please just add
flush_work(&led_cdev->set_brightness_work);
at the end of led_classdev_suspend()
in drivers/leds/led-class.c.
--
Best regards,
Jacek Anaszewski
next prev parent reply other threads:[~2020-07-01 21:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-01 9:35 [PATCH] leds: core: Use blocking op for system suspend Kai-Heng Feng
2020-07-01 21:28 ` Jacek Anaszewski [this message]
2020-07-02 5:20 ` Kai-Heng Feng
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=38622f5a-4518-cdb4-d1ca-581f470ce797@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;
as well as URLs for NNTP newsgroup(s).