diff options
author | Peter Zijlstra <peterz@infradead.org> | 2011-06-21 09:22:36 (GMT) |
---|---|---|
committer | Scott Wood <scottwood@freescale.com> | 2015-02-13 22:20:12 (GMT) |
commit | 8c46da9d8294b1f8a7827c325c3400dcd029836c (patch) | |
tree | bcb2c41f2087877e4437055ba465fd009dddef55 | |
parent | cf3fb7f885dab76bdafa2f147002928ca1e3dd6e (diff) | |
download | linux-fsl-qoriq-8c46da9d8294b1f8a7827c325c3400dcd029836c.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 2ece638..2c2cbc1 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_next_entry - get the next element in list * @pos: the type * to cursor * @member: the name of the list_struct within the struct. |