diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-12-10 20:06:28 -0800 |
---|---|---|
committer | Arve Hjønnevåg <arve@android.com> | 2009-04-07 16:42:56 -0700 |
commit | 10276fd993c6e4c92d8086a6ccd0c9e0ff53b053 (patch) | |
tree | d6c19b428d96f0a36c754cb047feb62cedc858d3 /kernel | |
parent | 539f6c334f7d44d8689200ad74dbc230086a8d87 (diff) |
sched: Enable might_sleep before initializing drivers.
This allows detection of init bugs in built-in drivers.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 8e2558c2ba67..2633e3da8452 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -8506,13 +8506,23 @@ void __init sched_init(void) } #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP +static int __might_sleep_init_called; +int __init __might_sleep_init(void) +{ + __might_sleep_init_called = 1; + return 0; +} +early_initcall(__might_sleep_init); + void __might_sleep(char *file, int line) { #ifdef in_atomic static unsigned long prev_jiffy; /* ratelimiting */ - if ((!in_atomic() && !irqs_disabled()) || - system_state != SYSTEM_RUNNING || oops_in_progress) + if ((!in_atomic() && !irqs_disabled()) || oops_in_progress) + return; + if (system_state != SYSTEM_RUNNING && + (!__might_sleep_init_called || system_state != SYSTEM_BOOTING)) return; if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy) return; |