diff options
author | Peter Zijlstra <peterz@infradead.org> | 2011-06-21 09:22:36 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2014-05-14 18:37:49 (GMT) |
commit | 422c8b0ba4a73ce3bed896668e478188a9b881f9 (patch) | |
tree | a890c9c23d96b5537ea00fd09275b2874c1388ae | |
parent | fafc8bc1f28910a260c8cb1b109b6ae00b8c75c5 (diff) | |
download | linux-fsl-qoriq-422c8b0ba4a73ce3bed896668e478188a9b881f9.tar.xz |
list-add-list-last-entry.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/linux/list.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index f4d8a2f..885943e 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. |