aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhang Bo <bo.zhang@nxp.com>2017-06-12 22:39:20 -0400
committerJacek Anaszewski <jacek.anaszewski@gmail.com>2017-06-13 14:37:01 -0400
commit436c4c45b5b9562b59cedbb51b7343ab4a6dd8cc (patch)
treefbb0404c6f5a627b349e590a5b324df24a5faa6a
parent4f02b50ece11dcf75263fb7a4cfe8a5df1cfabea (diff)
Revert "leds: handle suspend/resume in heartbeat trigger"
This reverts commit 5ab92a7cb82c66bf30685583a38a18538e3807db. System cannot enter suspend mode because of heartbeat led trigger. In autosleep_wq, try_to_suspend function will try to enter suspend mode in specific period. it will get wakeup_count then call pm_notifier chain callback function and freeze processes. Heartbeat_pm_notifier is called and it call led_trigger_unregister to change the trigger of led device to none. It will send uevent message and the wakeup source count changed. As wakeup_count changed, suspend will abort. Fixes: 5ab92a7cb82c ("leds: handle suspend/resume in heartbeat trigger") Signed-off-by: Zhang Bo <bo.zhang@nxp.com> Acked-by: Pavel Machek <pavel@ucw.cz> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
-rw-r--r--drivers/leds/trigger/ledtrig-heartbeat.c31
1 files changed, 0 insertions, 31 deletions
diff --git a/drivers/leds/trigger/ledtrig-heartbeat.c b/drivers/leds/trigger/ledtrig-heartbeat.c
index afa3b4099214..e95ea65380c8 100644
--- a/drivers/leds/trigger/ledtrig-heartbeat.c
+++ b/drivers/leds/trigger/ledtrig-heartbeat.c
@@ -20,7 +20,6 @@
20#include <linux/sched/loadavg.h> 20#include <linux/sched/loadavg.h>
21#include <linux/leds.h> 21#include <linux/leds.h>
22#include <linux/reboot.h> 22#include <linux/reboot.h>
23#include <linux/suspend.h>
24#include "../leds.h" 23#include "../leds.h"
25 24
26static int panic_heartbeats; 25static int panic_heartbeats;
@@ -163,30 +162,6 @@ static struct led_trigger heartbeat_led_trigger = {
163 .deactivate = heartbeat_trig_deactivate, 162 .deactivate = heartbeat_trig_deactivate,
164}; 163};
165 164
166static int heartbeat_pm_notifier(struct notifier_block *nb,
167 unsigned long pm_event, void *unused)
168{
169 int rc;
170
171 switch (pm_event) {
172 case PM_SUSPEND_PREPARE:
173 case PM_HIBERNATION_PREPARE:
174 case PM_RESTORE_PREPARE:
175 led_trigger_unregister(&heartbeat_led_trigger);
176 break;
177 case PM_POST_SUSPEND:
178 case PM_POST_HIBERNATION:
179 case PM_POST_RESTORE:
180 rc = led_trigger_register(&heartbeat_led_trigger);
181 if (rc)
182 pr_err("could not re-register heartbeat trigger\n");
183 break;
184 default:
185 break;
186 }
187 return NOTIFY_DONE;
188}
189
190static int heartbeat_reboot_notifier(struct notifier_block *nb, 165static int heartbeat_reboot_notifier(struct notifier_block *nb,
191 unsigned long code, void *unused) 166 unsigned long code, void *unused)
192{ 167{
@@ -201,10 +176,6 @@ static int heartbeat_panic_notifier(struct notifier_block *nb,
201 return NOTIFY_DONE; 176 return NOTIFY_DONE;
202} 177}
203 178
204static struct notifier_block heartbeat_pm_nb = {
205 .notifier_call = heartbeat_pm_notifier,
206};
207
208static struct notifier_block heartbeat_reboot_nb = { 179static struct notifier_block heartbeat_reboot_nb = {
209 .notifier_call = heartbeat_reboot_notifier, 180 .notifier_call = heartbeat_reboot_notifier,
210}; 181};
@@ -221,14 +192,12 @@ static int __init heartbeat_trig_init(void)
221 atomic_notifier_chain_register(&panic_notifier_list, 192 atomic_notifier_chain_register(&panic_notifier_list,
222 &heartbeat_panic_nb); 193 &heartbeat_panic_nb);
223 register_reboot_notifier(&heartbeat_reboot_nb); 194 register_reboot_notifier(&heartbeat_reboot_nb);
224 register_pm_notifier(&heartbeat_pm_nb);
225 } 195 }
226 return rc; 196 return rc;
227} 197}
228 198
229static void __exit heartbeat_trig_exit(void) 199static void __exit heartbeat_trig_exit(void)
230{ 200{
231 unregister_pm_notifier(&heartbeat_pm_nb);
232 unregister_reboot_notifier(&heartbeat_reboot_nb); 201 unregister_reboot_notifier(&heartbeat_reboot_nb);
233 atomic_notifier_chain_unregister(&panic_notifier_list, 202 atomic_notifier_chain_unregister(&panic_notifier_list,
234 &heartbeat_panic_nb); 203 &heartbeat_panic_nb);