Skip to content

Commit 15dba1e

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
hlist: Add hlist_is_singular_node() helper
Required to figure out whether the entry is the only one in the hlist. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arjan van de Ven <arjan@infradead.org> Cc: Chris Mason <clm@fb.com> Cc: Eric Dumazet <edumazet@google.com> Cc: George Spelvin <linux@sciencehorizons.net> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Len Brown <lenb@kernel.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@redhat.com> Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160704094341.867631372@linutronix.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 2b1ecc3 commit 15dba1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

include/linux/list.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,16 @@ static inline bool hlist_fake(struct hlist_node *h)
678678
return h->pprev == &h->next;
679679
}
680680

681+
/*
682+
* Check whether the node is the only node of the head without
683+
* accessing head:
684+
*/
685+
static inline bool
686+
hlist_is_singular_node(struct hlist_node *n, struct hlist_head *h)
687+
{
688+
return !n->next && n->pprev == &h->first;
689+
}
690+
681691
/*
682692
* Move a list from one list head to another. Fixup the pprev
683693
* reference of the first entry if it exists.

0 commit comments

Comments
 (0)