diff options
author | =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com> | 2011-12-02 13:50:11 +0800 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2011-12-02 13:50:11 +0800 |
commit | 8bc72c4d20602fa0d68cb723f9857d97e6a2e197 (patch) | |
tree | 6c2f37f1ed6565490e3804bc8b7c78c2fc99b15e /kernel | |
parent | f72dcd2a9eaca8e837710fc20a333b91e667ed28 (diff) |
sched: Enable might_sleep before initializing drivers.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 793d5943e1e..eda2231c2ad 100644 --- a/kernel/sched.c +++ b/kernel/sched.c @@ -8363,13 +8363,24 @@ 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 */ rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */ 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; |