aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2011-06-21 11:22:36 +0200
committerAnders Roxell <anders.roxell@linaro.org>2013-11-25 13:29:11 +0100
commita258375533f20605fc100fddfa2b255d51d287e1 (patch)
treed8ea6025fecbbc4f4a51e7170f6d74530055bd45 /include
parentb4adec3fda61a7da52d2e4992713206c8ff5aa63 (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 b83e5657365a..f6a9d3af4caf 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -373,6 +373,17 @@ static inline void list_splice_tail_init(struct list_head *list,
(!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
/**
+ * 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.