diff options
Diffstat (limited to 'kernel/async.c')
-rw-r--r-- | kernel/async.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/async.c b/kernel/async.c index f286e9f2b736..608b32b42812 100644 --- a/kernel/async.c +++ b/kernel/async.c | |||
@@ -90,12 +90,12 @@ extern int initcall_debug; | |||
90 | static async_cookie_t __lowest_in_progress(struct list_head *running) | 90 | static async_cookie_t __lowest_in_progress(struct list_head *running) |
91 | { | 91 | { |
92 | struct async_entry *entry; | 92 | struct async_entry *entry; |
93 | if (!list_empty(&async_pending)) { | 93 | if (!list_empty(running)) { |
94 | entry = list_first_entry(&async_pending, | 94 | entry = list_first_entry(running, |
95 | struct async_entry, list); | 95 | struct async_entry, list); |
96 | return entry->cookie; | 96 | return entry->cookie; |
97 | } else if (!list_empty(running)) { | 97 | } else if (!list_empty(&async_pending)) { |
98 | entry = list_first_entry(running, | 98 | entry = list_first_entry(&async_pending, |
99 | struct async_entry, list); | 99 | struct async_entry, list); |
100 | return entry->cookie; | 100 | return entry->cookie; |
101 | } else { | 101 | } else { |
@@ -104,6 +104,17 @@ static async_cookie_t __lowest_in_progress(struct list_head *running) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | } | 106 | } |
107 | |||
108 | static async_cookie_t lowest_in_progress(struct list_head *running) | ||
109 | { | ||
110 | unsigned long flags; | ||
111 | async_cookie_t ret; | ||
112 | |||
113 | spin_lock_irqsave(&async_lock, flags); | ||
114 | ret = __lowest_in_progress(running); | ||
115 | spin_unlock_irqrestore(&async_lock, flags); | ||
116 | return ret; | ||
117 | } | ||
107 | /* | 118 | /* |
108 | * pick the first pending entry and run it | 119 | * pick the first pending entry and run it |
109 | */ | 120 | */ |
@@ -229,7 +240,7 @@ void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *r | |||
229 | starttime = ktime_get(); | 240 | starttime = ktime_get(); |
230 | } | 241 | } |
231 | 242 | ||
232 | wait_event(async_done, __lowest_in_progress(running) >= cookie); | 243 | wait_event(async_done, lowest_in_progress(running) >= cookie); |
233 | 244 | ||
234 | if (initcall_debug && system_state == SYSTEM_BOOTING) { | 245 | if (initcall_debug && system_state == SYSTEM_BOOTING) { |
235 | endtime = ktime_get(); | 246 | endtime = ktime_get(); |