[PATCH 04/13] PM: wakelock: Override wakelocks when using /sys/power/state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This preserves existing functionality when CONFIG_WAKELOCK is set.
Signed-off-by: Arve Hjønnevåg <arve@xxxxxxxxxxx>--- kernel/power/main.c     |    7 +++++++ kernel/power/power.h    |    1 + kernel/power/wakelock.c |    4 ++++ 3 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/kernel/power/main.c b/kernel/power/main.cindex 2399888..ab9fc7f 100644--- a/kernel/power/main.c+++ b/kernel/power/main.c@@ -515,6 +515,10 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, 	p = memchr(buf, '\n', n); 	len = p ? p - buf : n; +#ifdef CONFIG_WAKELOCK+	ignore_suspend_wakelocks = 1;+#endif+ 	/* First, check if we are requested to hibernate */ 	if (len == 4 && !strncmp(buf, "disk", len)) { 		error = hibernate();@@ -531,6 +535,9 @@ static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr, #endif   Exit:+#ifdef CONFIG_WAKELOCK+	ignore_suspend_wakelocks = 0;+#endif 	return error ? error : n; } diff --git a/kernel/power/power.h b/kernel/power/power.hindex 1527174..ed1b7f4 100644--- a/kernel/power/power.h+++ b/kernel/power/power.h@@ -229,4 +229,5 @@ static inline void suspend_thaw_processes(void) extern struct workqueue_struct *suspend_work_queue; extern struct wake_lock main_wake_lock; extern suspend_state_t requested_suspend_state;+extern bool ignore_suspend_wakelocks; #endifdiff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.cindex c9e22f9..8a8608e 100644--- a/kernel/power/wakelock.c+++ b/kernel/power/wakelock.c@@ -47,6 +47,7 @@ static int current_event_num; struct workqueue_struct *suspend_work_queue; struct wake_lock main_wake_lock; suspend_state_t requested_suspend_state = PM_SUSPEND_MEM;+bool ignore_suspend_wakelocks; static struct wake_lock unknown_wakeup;  #ifdef CONFIG_WAKELOCK_STAT@@ -260,6 +261,9 @@ long has_wake_lock(int type) { 	long ret; 	unsigned long irqflags;+	if (WARN_ONCE(type == WAKE_LOCK_SUSPEND && ignore_suspend_wakelocks,+							"ignoring wakelocks\n"))+		return 0; 	spin_lock_irqsave(&list_lock, irqflags); 	ret = has_wake_lock_locked(type); 	spin_unlock_irqrestore(&list_lock, irqflags);-- 1.6.1
_______________________________________________linux-pm mailing listlinux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx://lists.linux-foundation.org/mailman/listinfo/linux-pm


[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux