summaryrefslogtreecommitdiffstats
path: root/kernel/async.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2013-03-12 13:59:13 -0700
committerTejun Heo <tj@kernel.org>2013-03-12 13:59:13 -0700
commit92266d6ef60c2381c980c6cdcb2a5c1667b36b49 (patch)
treefe785136c54cbfb3f6ec837e2ae9e2f467c699ea /kernel/async.c
parent6dbe51c251a327e012439c4772097a13df43c5b8 (diff)
downloadop-kernel-dev-92266d6ef60c2381c980c6cdcb2a5c1667b36b49.zip
op-kernel-dev-92266d6ef60c2381c980c6cdcb2a5c1667b36b49.tar.gz
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>
Diffstat (limited to 'kernel/async.c')
-rw-r--r--kernel/async.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/kernel/async.c b/kernel/async.c
index 8ddee2c..ab99c92 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -84,24 +84,20 @@ static atomic_t entry_count;
static async_cookie_t lowest_in_progress(struct async_domain *domain)
{
- struct async_entry *first = NULL;
+ struct list_head *pending;
async_cookie_t ret = ASYNC_COOKIE_MAX;
unsigned long flags;
spin_lock_irqsave(&async_lock, flags);
- if (domain) {
- if (!list_empty(&domain->pending))
- first = list_first_entry(&domain->pending,
- struct async_entry, domain_list);
- } else {
- if (!list_empty(&async_global_pending))
- first = list_first_entry(&async_global_pending,
- struct async_entry, global_list);
- }
+ if (domain)
+ pending = &domain->pending;
+ else
+ pending = &async_global_pending;
- if (first)
- ret = first->cookie;
+ if (!list_empty(pending))
+ ret = list_first_entry(pending, struct async_entry,
+ domain_list)->cookie;
spin_unlock_irqrestore(&async_lock, flags);
return ret;
OpenPOWER on IntegriCloud