summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-02-11 14:41:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2012-02-17 10:27:15 +0100
commit6ca081d53dde57475600a9ea65856c6fbbdfd9f0 (patch)
tree009817d5109697c8e68e55922e67dcbdaf78c854 /include
parent4b06ebc820aa9a46dfb73c7050b073d8224b4b70 (diff)
downloadbarebox-6ca081d53dde57475600a9ea65856c6fbbdfd9f0.tar.gz
barebox-6ca081d53dde57475600a9ea65856c6fbbdfd9f0.tar.xz
add list_is_singular
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/list.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 1a4cbc49a2..eb1b640e28 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)
{