linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sanshan zhang <sanshan.zhang@nxp.com>
To: linux-kernel@vger.kernel.org
Cc: linux-leds@vger.kernel.org, pavel@ucw.cz,
	j.anaszewski@samsung.com, rpurdie@rpsys.net
Subject: [PATCH] leds/trigger: system can't enter suspend.
Date: Sun, 7 May 2017 10:01:21 +0800	[thread overview]
Message-ID: <1494122481-15228-1-git-send-email-sanshan.zhang@nxp.com> (raw)

From: zhang sanshan <sanshan.zhang@nxp.com>

system can't enter suspend when enable led heartbeat.

pm will call heartbeat_pm_notifier when suspend.
system will prepare led states, and led_trigger_unregister
will use led_trigger_set to set trigger.
kobject_uevent_env will send event,it will call ep_poll_callback
to hold a wakeup source if we enable wakelock in kernel.
So that system can't enter suspend.

If we set led device tigger to NONE, there is not need to
send notification to user space.

Change-Id: I9f7ee5764d7e31b9a225dae5517cb36137675f9d
Signed-off-by: zhang sanshan <sanshan.zhang@nxp.com>
Signed-off-by: Zhang Bo <bo.zhang@nxp.com>
---
 drivers/leds/led-triggers.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 431123b..f03c2bd1 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -108,13 +108,10 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
 	unsigned long flags;
 	char *event = NULL;
 	char *envp[2];
-	const char *name;
 
 	if (!led_cdev->trigger && !trig)
 		return;
 
-	name = trig ? trig->name : "none";
-	event = kasprintf(GFP_KERNEL, "TRIGGER=%s", name);
 
 	/* Remove any existing trigger */
 	if (led_cdev->trigger) {
@@ -138,6 +135,10 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
 			trig->activate(led_cdev);
 	}
 
+	if (NULL != trig)
+		event = kasprintf(GFP_KERNEL, "TRIGGER=%s", trig->name);
+	else
+		return;
 	if (event) {
 		envp[0] = event;
 		envp[1] = NULL;
-- 
1.9.1

             reply	other threads:[~2017-05-07  2:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-07  2:01 sanshan zhang [this message]
2017-05-07  8:30 ` [PATCH] leds/trigger: system can't enter suspend Pavel Machek
2017-05-07 10:55   ` Pete Zhang
2017-05-10 20:51 ` Jacek Anaszewski

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=1494122481-15228-1-git-send-email-sanshan.zhang@nxp.com \
    --to=sanshan.zhang@nxp.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rpurdie@rpsys.net \
    /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).