diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2013-03-12 16:59:13 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2013-03-12 16:59:13 -0400 |
commit | 92266d6ef60c2381c980c6cdcb2a5c1667b36b49 (patch) | |
tree | fe785136c54cbfb3f6ec837e2ae9e2f467c699ea | |
parent | 6dbe51c251a327e012439c4772097a13df43c5b8 (diff) |
async: simplify lowest_in_progress()
The code in lowest_in_progress() are duplicated in two branches,
simplify them.
tj: Minor indentation adjustment.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Arjan van de Ven <arjan@linux.intel.com>
-rw-r--r-- | kernel/async.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/kernel/async.c b/kernel/async.c index 8ddee2c3e5b0..ab99c92f6b68 100644 --- a/kernel/async.c +++ b/kernel/async.c | |||
@@ -84,24 +84,20 @@ 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 async_entry *first = NULL; | 87 | struct list_head *pending; |
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 | if (!list_empty(&domain->pending)) | 94 | pending = &domain->pending; |
95 | first = list_first_entry(&domain->pending, | 95 | else |
96 | struct async_entry, domain_list); | 96 | pending = &async_global_pending; |
97 | } else { | ||
98 | if (!list_empty(&async_global_pending)) | ||
99 | first = list_first_entry(&async_global_pending, | ||
100 | struct async_entry, global_list); | ||
101 | } | ||
102 | 97 | ||
103 | if (first) | 98 | if (!list_empty(pending)) |
104 | ret = first->cookie; | 99 | ret = list_first_entry(pending, struct async_entry, |
100 | domain_list)->cookie; | ||
105 | 101 | ||
106 | spin_unlock_irqrestore(&async_lock, flags); | 102 | spin_unlock_irqrestore(&async_lock, flags); |
107 | return ret; | 103 | return ret; |