[PATCH 01/12] add list_is_singular
Sascha Hauer
s.hauer at pengutronix.de
Wed Feb 15 03:22:34 EST 2012
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
include/linux/list.h | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/include/linux/list.h b/include/linux/list.h
index 15ed499..5ae90b4 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -210,6 +210,15 @@ static inline int list_empty_careful(const struct list_head *head)
return (next == head) && (next == head->prev);
}
+/**
+ * list_is_singular - tests whether a list has just one entry.
+ * @head: the list to test.
+ */
+static inline int list_is_singular(const struct list_head *head)
+{
+ return !list_empty(head) && (head->next == head->prev);
+}
+
static inline void __list_splice(struct list_head *list,
struct list_head *head)
{
--
1.7.9
More information about the barebox
mailing list