diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2013-08-27 14:20:26 -0400 |
---|---|---|
committer | Anders Roxell <anders.roxell@linaro.org> | 2015-06-24 21:13:11 +0200 |
commit | 2727c0aa087ea318d669f37075f6b35a82268a71 (patch) | |
tree | 766e55863e359041c49522cc020c5890914880ea | |
parent | bf50f5d61a3c99bc319d5e5aa5706fc2fc1a5c25 (diff) |
simple-wait: rename and export the equivalent of waitqueue_active()
The function "swait_head_has_waiters()" was internalized into
wait-simple.c but it parallels the waitqueue_active of normal
waitqueue support. Given that there are over 150 waitqueue_active
users in drivers/ fs/ kernel/ and the like, lets make it globally
visible, and rename it to parallel the waitqueue_active accordingly.
We'll need to do this if we expect to expand its usage beyond RT.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | include/linux/wait-simple.h | 8 | ||||
-rw-r--r-- | kernel/sched/wait-simple.c | 10 |
2 files changed, 9 insertions, 9 deletions
diff --git a/include/linux/wait-simple.h b/include/linux/wait-simple.h index 4efba4d28c48..f86bca2c41d5 100644 --- a/include/linux/wait-simple.h +++ b/include/linux/wait-simple.h @@ -47,6 +47,14 @@ extern void swait_prepare(struct swait_head *head, struct swaiter *w, int state) extern void swait_finish_locked(struct swait_head *head, struct swaiter *w); extern void swait_finish(struct swait_head *head, struct swaiter *w); +/* Check whether a head has waiters enqueued */ +static inline bool swaitqueue_active(struct swait_head *h) +{ + /* Make sure the condition is visible before checking list_empty() */ + smp_mb(); + return !list_empty(&h->list); +} + /* * Wakeup functions */ diff --git a/kernel/sched/wait-simple.c b/kernel/sched/wait-simple.c index 2c856267445b..7dfa86d1f654 100644 --- a/kernel/sched/wait-simple.c +++ b/kernel/sched/wait-simple.c @@ -26,14 +26,6 @@ static inline void __swait_dequeue(struct swaiter *w) list_del_init(&w->node); } -/* Check whether a head has waiters enqueued */ -static inline bool swait_head_has_waiters(struct swait_head *h) -{ - /* Make sure the condition is visible before checking list_empty() */ - smp_mb(); - return !list_empty(&h->list); -} - void __init_swait_head(struct swait_head *head, struct lock_class_key *key) { raw_spin_lock_init(&head->lock); @@ -112,7 +104,7 @@ __swait_wake(struct swait_head *head, unsigned int state, unsigned int num) unsigned long flags; int woken; - if (!swait_head_has_waiters(head)) + if (!swaitqueue_active(head)) return 0; raw_spin_lock_irqsave(&head->lock, flags); |