aboutsummaryrefslogtreecommitdiff
path: root/kernel/async.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-02-28 12:01:09 +0800
committerAlex Shi <alex.shi@linaro.org>2018-02-28 12:01:09 +0800
commit6e49b7fa3083c30688b7fff1b37ed891cd1c30af (patch)
tree3054864f2e58bcd86000567ce99e25753ddc794a /kernel/async.c
parent2ba51c6d36ee1b43c1f898c6c48ddf3d33e9ab30 (diff)
parentbe42cd02846a611af533103a3f4b6a7d8c592f49 (diff)
Merge remote-tracking branch 'rt-stable/v4.9-rt' into linux-linaro-lsk-v4.9-rtlsk-v4.9-18.03-rt
Diffstat (limited to 'kernel/async.c')
-rw-r--r--kernel/async.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/kernel/async.c b/kernel/async.c
index d2edd6efec56..d84d4860992e 100644
--- a/kernel/async.c
+++ b/kernel/async.c
@@ -84,20 +84,24 @@ static atomic_t entry_count;
static async_cookie_t lowest_in_progress(struct async_domain *domain)
{
- struct list_head *pending;
+ struct async_entry *first = NULL;
async_cookie_t ret = ASYNC_COOKIE_MAX;
unsigned long flags;
spin_lock_irqsave(&async_lock, flags);
- if (domain)
- pending = &domain->pending;
- else
- pending = &async_global_pending;
+ 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 (!list_empty(pending))
- ret = list_first_entry(pending, struct async_entry,
- domain_list)->cookie;
+ if (first)
+ ret = first->cookie;
spin_unlock_irqrestore(&async_lock, flags);
return ret;