Revert "leds: handle suspend/resume in heartbeat trigger"
This reverts commit5ab92a7cb8
. 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:5ab92a7cb8
("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>
This commit is contained in:

committed by
Jacek Anaszewski

parent
4f02b50ece
commit
436c4c45b5
@@ -20,7 +20,6 @@
|
|||||||
#include <linux/sched/loadavg.h>
|
#include <linux/sched/loadavg.h>
|
||||||
#include <linux/leds.h>
|
#include <linux/leds.h>
|
||||||
#include <linux/reboot.h>
|
#include <linux/reboot.h>
|
||||||
#include <linux/suspend.h>
|
|
||||||
#include "../leds.h"
|
#include "../leds.h"
|
||||||
|
|
||||||
static int panic_heartbeats;
|
static int panic_heartbeats;
|
||||||
@@ -163,30 +162,6 @@ static struct led_trigger heartbeat_led_trigger = {
|
|||||||
.deactivate = heartbeat_trig_deactivate,
|
.deactivate = heartbeat_trig_deactivate,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int heartbeat_pm_notifier(struct notifier_block *nb,
|
|
||||||
unsigned long pm_event, void *unused)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
switch (pm_event) {
|
|
||||||
case PM_SUSPEND_PREPARE:
|
|
||||||
case PM_HIBERNATION_PREPARE:
|
|
||||||
case PM_RESTORE_PREPARE:
|
|
||||||
led_trigger_unregister(&heartbeat_led_trigger);
|
|
||||||
break;
|
|
||||||
case PM_POST_SUSPEND:
|
|
||||||
case PM_POST_HIBERNATION:
|
|
||||||
case PM_POST_RESTORE:
|
|
||||||
rc = led_trigger_register(&heartbeat_led_trigger);
|
|
||||||
if (rc)
|
|
||||||
pr_err("could not re-register heartbeat trigger\n");
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NOTIFY_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int heartbeat_reboot_notifier(struct notifier_block *nb,
|
static int heartbeat_reboot_notifier(struct notifier_block *nb,
|
||||||
unsigned long code, void *unused)
|
unsigned long code, void *unused)
|
||||||
{
|
{
|
||||||
@@ -201,10 +176,6 @@ static int heartbeat_panic_notifier(struct notifier_block *nb,
|
|||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct notifier_block heartbeat_pm_nb = {
|
|
||||||
.notifier_call = heartbeat_pm_notifier,
|
|
||||||
};
|
|
||||||
|
|
||||||
static struct notifier_block heartbeat_reboot_nb = {
|
static struct notifier_block heartbeat_reboot_nb = {
|
||||||
.notifier_call = heartbeat_reboot_notifier,
|
.notifier_call = heartbeat_reboot_notifier,
|
||||||
};
|
};
|
||||||
@@ -221,14 +192,12 @@ static int __init heartbeat_trig_init(void)
|
|||||||
atomic_notifier_chain_register(&panic_notifier_list,
|
atomic_notifier_chain_register(&panic_notifier_list,
|
||||||
&heartbeat_panic_nb);
|
&heartbeat_panic_nb);
|
||||||
register_reboot_notifier(&heartbeat_reboot_nb);
|
register_reboot_notifier(&heartbeat_reboot_nb);
|
||||||
register_pm_notifier(&heartbeat_pm_nb);
|
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit heartbeat_trig_exit(void)
|
static void __exit heartbeat_trig_exit(void)
|
||||||
{
|
{
|
||||||
unregister_pm_notifier(&heartbeat_pm_nb);
|
|
||||||
unregister_reboot_notifier(&heartbeat_reboot_nb);
|
unregister_reboot_notifier(&heartbeat_reboot_nb);
|
||||||
atomic_notifier_chain_unregister(&panic_notifier_list,
|
atomic_notifier_chain_unregister(&panic_notifier_list,
|
||||||
&heartbeat_panic_nb);
|
&heartbeat_panic_nb);
|
||||||
|
Reference in New Issue
Block a user