aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2011-06-21 11:22:36 +0200
committerSteven Rostedt <rostedt@rostedt.homelinux.com>2013-05-20 13:45:31 -0400
commite8c00a0c3d1cb61d09a461023a5603a7eae0767a (patch)
treedddddbea0663f7f9474c0b800a7326a7a9b797fb /include
parent6246096a81b5bde359a5f717d3a52f30bcd93b04 (diff)
list-add-list-last-entry.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/list.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index cc6d2aa6b415..7a9851bbef04 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -362,6 +362,17 @@ static inline void list_splice_tail_init(struct list_head *list,
list_entry((ptr)->next, type, member)
/**
+ * list_last_entry - get the last element from a list
+ * @ptr: the list head to take the element from.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ *
+ * Note, that list is expected to be not empty.
+ */
+#define list_last_entry(ptr, type, member) \
+ list_entry((ptr)->prev, type, member)
+
+/**
* list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor.
* @head: the head for your list.