X-Git-Url: https://git.stricted.de/?a=blobdiff_plain;f=kernel%2Fasync.c;h=a893d6170944f7264c63e1e890420c9ecd0e9855;hb=99b9e031038ee010b65e58eb653ceefb6ad7f7f8;hp=2cbd3dd5940dea73e2707147cb7a383cbacbec27;hpb=5896ec77d70d33dd38a455b0aa5f3154aeecea09;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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; 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;