aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-09-01 13:47:49 +0200
committerMoyster <oysterized@gmail.com>2019-05-02 18:32:43 +0200
commit3a957735404718a8e010737c1c0bb3025fdcfb4d (patch)
tree3df930f7a86cafaf88c14f6958bad2130fb27c87 /drivers
parent3d9de0a637cea0b04567a972a36183f3fe7d6e01 (diff)
PM / sleep: Mechanism for aborting system suspends unconditionally
It sometimes may be necessary to abort a system suspend in progress or wake up the system from suspend-to-idle even if the pm_wakeup_event()/pm_stay_awake() mechanism is not enabled. For this purpose, introduce a new global variable pm_abort_suspend and make pm_wakeup_pending() check its value. Also add routines for manipulating that variable. Change-Id: I694bee866a1b9e85a724f3efec09326d47a4ef6e Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/power/wakeup.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 96ffdb24b..ea313db99 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -42,6 +42,10 @@ int wakeup_debug = 0;
* if wakeup events are registered during or immediately before the transition.
*/
bool events_check_enabled __read_mostly;
+
+/* If set and the system is suspending, terminate the suspend. */
+static bool pm_abort_suspend __read_mostly;
+
EXPORT_SYMBOL_GPL(events_check_enabled);
/*
@@ -796,7 +800,18 @@ bool pm_wakeup_pending(void)
if (ret)
print_active_wakeup_sources();
- return ret;
+ return ret || pm_abort_suspend;
+}
+
+void pm_system_wakeup(void)
+{
+ pm_abort_suspend = true;
+ freeze_wake();
+}
+
+void pm_wakeup_clear(void)
+{
+ pm_abort_suspend = false;
}
EXPORT_SYMBOL_GPL(pm_wakeup_pending);