diff options
author | Peter Zijlstra <peterz@infradead.org> | 2011-06-21 09:22:36 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2013-04-04 22:09:10 (GMT) |
commit | 14aba70a81f6a5f4058a68ff130b57e1e4640e65 (patch) | |
tree | c3cf9cd8cde71879ea4e5925dc05368747c7bf07 /include/linux/list.h | |
parent | f89b6e68ce427bc5910c7b2c8700880832bf5a06 (diff) | |
download | linux-fsl-qoriq-14aba70a81f6a5f4058a68ff130b57e1e4640e65.tar.xz |
list-add-list-last-entry.patch
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/list.h')
-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 cc6d2aa..7a9851b 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. |