add the 'goldfish' target, useful for experimenting with virtual phone hardware ...
[openwrt/openwrt.git] / target / linux / goldfish / patches-2.6.30 / 0070-PM-wakelock-Abort-task-freezing-if-a-wake-lock-is.patch
1 From 3f8e407c418205252f00615da4d0182e8c960344 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Tue, 14 Oct 2008 16:02:39 -0700
4 Subject: [PATCH 070/134] PM: wakelock: Abort task freezing if a wake lock is held.
5
6 Avoids a problem where the device sometimes hangs for 20 seconds
7 before the screen is turned on.
8 ---
9 kernel/power/process.c | 23 ++++++++++++++++++-----
10 1 files changed, 18 insertions(+), 5 deletions(-)
11
12 --- a/kernel/power/process.c
13 +++ b/kernel/power/process.c
14 @@ -13,6 +13,7 @@
15 #include <linux/module.h>
16 #include <linux/syscalls.h>
17 #include <linux/freezer.h>
18 +#include <linux/wakelock.h>
19
20 /*
21 * Timeout for stopping processes
22 @@ -36,6 +37,7 @@ static int try_to_freeze_tasks(bool sig_
23 struct timeval start, end;
24 u64 elapsed_csecs64;
25 unsigned int elapsed_csecs;
26 + unsigned int wakeup = 0;
27
28 do_gettimeofday(&start);
29
30 @@ -62,6 +64,10 @@ static int try_to_freeze_tasks(bool sig_
31 } while_each_thread(g, p);
32 read_unlock(&tasklist_lock);
33 yield(); /* Yield is okay here */
34 + if (todo && has_wake_lock(WAKE_LOCK_SUSPEND)) {
35 + wakeup = 1;
36 + break;
37 + }
38 if (time_after(jiffies, end_time))
39 break;
40 } while (todo);
41 @@ -77,11 +83,18 @@ static int try_to_freeze_tasks(bool sig_
42 * and caller must call thaw_processes() if something fails),
43 * but it cleans up leftover PF_FREEZE requests.
44 */
45 - printk("\n");
46 - printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
47 - "(%d tasks refusing to freeze):\n",
48 - elapsed_csecs / 100, elapsed_csecs % 100, todo);
49 - show_state();
50 + if(wakeup) {
51 + printk("\n");
52 + printk(KERN_ERR "Freezing of %s aborted\n",
53 + sig_only ? "user space " : "tasks ");
54 + }
55 + else {
56 + printk("\n");
57 + printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
58 + "(%d tasks refusing to freeze):\n",
59 + elapsed_csecs / 100, elapsed_csecs % 100, todo);
60 + show_state();
61 + }
62 read_lock(&tasklist_lock);
63 do_each_thread(g, p) {
64 task_lock(p);