From e8f4d97e1b58b50ad6449bb2d35e6632c0236abd Mon Sep 17 00:00:00 2001 From: Shailabh Nagar Date: Fri, 14 Jul 2006 00:24:35 -0700 Subject: [PATCH] list_is_last utility Add another list utility function to check for last element in a list. Signed-off-by: Shailabh Nagar Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/list.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/list.h b/include/linux/list.h index 6b74adf5297f64..65a5b5ceda4947 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -264,6 +264,17 @@ static inline void list_move_tail(struct list_head *list, 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 * @head: the list to test. -- cgit 1.2.3-korg