Commit e8f4d97e authored by Shailabh Nagar's avatar Shailabh Nagar Committed by Linus Torvalds

[PATCH] list_is_last utility

Add another list utility function to check for last element in a list.
Signed-off-by: default avatarShailabh Nagar <nagar@watson.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 22caf042
...@@ -264,6 +264,17 @@ static inline void list_move_tail(struct list_head *list, ...@@ -264,6 +264,17 @@ static inline void list_move_tail(struct list_head *list,
list_add_tail(list, head); list_add_tail(list, head);
} }
/**
* list_is_last - tests whether @list is the last entry in list @head
* @list: the entry to test
* @head: the head of the list
*/
static inline int list_is_last(const struct list_head *list,
const struct list_head *head)
{
return list->next == head;
}
/** /**
* list_empty - tests whether a list is empty * list_empty - tests whether a list is empty
* @head: the list to test. * @head: the list to test.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment