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 <[email protected]> Reviewed-by: Frederic Weisbecker <[email protected]> Cc: Arjan van de Ven <[email protected]> Cc: Chris Mason <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: George Spelvin <[email protected]> Cc: Josh Triplett <[email protected]> Cc: Len Brown <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Paul E. McKenney <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rik van Riel <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
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)