Skip to contentSkip to conversation

simple-wait: rename and export the equivalent of waitqueue_active()

PATCH New Paul Gortmaker 1 participant 1 message Aug 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

[Assumption here is that we'll want to mainline the simple wait
queue support, and hence want to align the names and all API like stuff as much as possible before submitting to mainline.]

 include/linux/wait-simple.h |  8 ++++++++
 kernel/wait-simple.c        | 10 +---------
 2 files changed, 9 insertions(+), 9 deletions(-)
include/linux/wait-simple.h +8 -0
index 4efba4d..f86bca2 100644
@@ -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
  */
kernel/wait-simple.c +0 -7
index 2c85626..7dfa86d 100644
@@ -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);
-}