diff options
Diffstat (limited to 'kernel/async.c')
-rw-r--r-- | kernel/async.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/async.c b/kernel/async.c index 2cbd3dd5940d..a893d6170944 100644 --- a/kernel/async.c +++ b/kernel/async.c | |||
@@ -84,20 +84,24 @@ static atomic_t entry_count; | |||
84 | 84 | ||
85 | static async_cookie_t lowest_in_progress(struct async_domain *domain) | 85 | static async_cookie_t lowest_in_progress(struct async_domain *domain) |
86 | { | 86 | { |
87 | struct list_head *pending; | 87 | struct async_entry *first = NULL; |
88 | async_cookie_t ret = ASYNC_COOKIE_MAX; | 88 | async_cookie_t ret = ASYNC_COOKIE_MAX; |
89 | unsigned long flags; | 89 | unsigned long flags; |
90 | 90 | ||
91 | spin_lock_irqsave(&async_lock, flags); | 91 | spin_lock_irqsave(&async_lock, flags); |
92 | 92 | ||
93 | if (domain) | 93 | if (domain) { |
94 | pending = &domain->pending; | 94 | if (!list_empty(&domain->pending)) |
95 | else | 95 | first = list_first_entry(&domain->pending, |
96 | pending = &async_global_pending; | 96 | struct async_entry, domain_list); |
97 | } else { | ||
98 | if (!list_empty(&async_global_pending)) | ||
99 | first = list_first_entry(&async_global_pending, | ||
100 | struct async_entry, global_list); | ||
101 | } | ||
97 | 102 | ||
98 | if (!list_empty(pending)) | 103 | if (first) |
99 | ret = list_first_entry(pending, struct async_entry, | 104 | ret = first->cookie; |
100 | domain_list)->cookie; | ||
101 | 105 | ||
102 | spin_unlock_irqrestore(&async_lock, flags); | 106 | spin_unlock_irqrestore(&async_lock, flags); |
103 | return ret; | 107 | return ret; |