[generic/3.3]: refresh patches to -rc3
[openwrt.git] / target / linux / goldfish / patches-2.6.30 / 0058-sched-Enable-might_sleep-before-initializing-driver.patch
1 From 10276fd993c6e4c92d8086a6ccd0c9e0ff53b053 Mon Sep 17 00:00:00 2001
2 From: =?utf-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
3 Date: Wed, 10 Dec 2008 20:06:28 -0800
4 Subject: [PATCH 058/134] sched: Enable might_sleep before initializing drivers.
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=utf-8
7 Content-Transfer-Encoding: 8bit
8
9 This allows detection of init bugs in built-in drivers.
10
11 Signed-off-by: Arve Hjønnevåg <arve@android.com>
12 ---
13 kernel/sched.c | 14 ++++++++++++--
14 1 files changed, 12 insertions(+), 2 deletions(-)
15
16 --- a/kernel/sched.c
17 +++ b/kernel/sched.c
18 @@ -9065,13 +9065,23 @@ void __init sched_init(void)
19 }
20
21 #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
22 +static int __might_sleep_init_called;
23 +int __init __might_sleep_init(void)
24 +{
25 + __might_sleep_init_called = 1;
26 + return 0;
27 +}
28 +early_initcall(__might_sleep_init);
29 +
30 void __might_sleep(char *file, int line)
31 {
32 #ifdef in_atomic
33 static unsigned long prev_jiffy; /* ratelimiting */
34
35 - if ((!in_atomic() && !irqs_disabled()) ||
36 - system_state != SYSTEM_RUNNING || oops_in_progress)
37 + if ((!in_atomic() && !irqs_disabled()) || oops_in_progress)
38 + return;
39 + if (system_state != SYSTEM_RUNNING &&
40 + (!__might_sleep_init_called || system_state != SYSTEM_BOOTING))
41 return;
42 if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
43 return;
This page took 0.044103 seconds and 5 git commands to generate.