===================================================================
@@ -371,6 +371,8 @@ extern int unregister_pm_notifier(struct
extern bool events_check_enabled;
extern bool pm_wakeup_pending(void);
+extern void pm_system_wakeup(void);
+extern void pm_wakeup_clear(void);
extern bool pm_get_wakeup_count(unsigned int *count, bool block);
extern bool pm_save_wakeup_count(unsigned int count);
extern void pm_wakep_autosleep_enabled(bool set);
@@ -418,6 +420,8 @@ static inline int unregister_pm_notifier
#define pm_notifier(fn, pri) do { (void)(fn); } while (0)
static inline bool pm_wakeup_pending(void) { return false; }
+static inline void pm_system_wakeup(void) {}
+static inline void pm_wakeup_clear(void) {}
static inline void lock_system_sleep(void) {}
static inline void unlock_system_sleep(void) {}
===================================================================
@@ -691,6 +691,8 @@ void pm_print_active_wakeup_sources(void
}
EXPORT_SYMBOL_GPL(pm_print_active_wakeup_sources);
+static bool abort_suspend;
+
/**
* pm_wakeup_pending - Check if power transition in progress should be aborted.
*
@@ -712,6 +714,7 @@ bool pm_wakeup_pending(void)
ret = (cnt != saved_count || inpr > 0);
events_check_enabled = !ret;
}
+ ret = ret || abort_suspend;
spin_unlock_irqrestore(&events_lock, flags);
if (ret) {
@@ -722,6 +725,23 @@ bool pm_wakeup_pending(void)
return ret;
}
+void pm_system_wakeup(void)
+{
+ unsigned long flags;
+
+ spin_lock_irqsave(&events_lock, flags);
+ abort_suspend = true;
+ spin_unlock_irqrestore(&events_lock, flags);
+ freeze_wake();
+}
+
+void pm_wakeup_clear(void)
+{
+ spin_lock_irq(&events_lock);
+ abort_suspend = false;
+ spin_unlock_irq(&events_lock);
+}
+
/**
* pm_get_wakeup_count - Read the number of registered wakeup events.
* @count: Address to store the value at.
===================================================================
@@ -129,6 +129,7 @@ int freeze_processes(void)
if (!pm_freezing)
atomic_inc(&system_freezing_cnt);
+ pm_wakeup_clear();
printk("Freezing user space processes ... ");
pm_freezing = true;
error = try_to_freeze_tasks(true);