diff options
author | Arve Hjønnevåg <arve@android.com> | 2008-12-10 20:06:28 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:37:51 -0800 |
commit | 6bd233df04316d8d3ef8445a4c45f8b8afda42d9 (patch) | |
tree | 82dd2c019b52ca7c972b270773ed2f3f85b8d591 /kernel | |
parent | e10525beeb7f0f0baf70efd36063de728b35e603 (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 | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index b50b0f0c9aa9..d0f600c94843 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -8202,12 +8202,23 @@ static inline int preempt_count_equals(int preempt_offset) return (nested == preempt_offset); } +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(const char *file, int line, int preempt_offset) { static unsigned long prev_jiffy; /* ratelimiting */ if ((preempt_count_equals(preempt_offset) && !irqs_disabled()) || - system_state != SYSTEM_RUNNING || oops_in_progress) + 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; |