4ee9047979f5120f4f9c1a6847c5ff6f3c74834d
[openwrt.git] / package / kernel / mac80211 / patches / 082-backport-list_last_entry.patch
1 --- a/backport-include/linux/list.h
2 +++ b/backport-include/linux/list.h
3 @@ -73,4 +73,17 @@
4         list_entry((pos)->member.next, typeof(*(pos)), member)
5  #endif /* list_next_entry */
6  
7 +#ifndef list_last_entry
8 +/**
9 + * list_last_entry - get the last element from a list
10 + * @ptr:       the list head to take the element from.
11 + * @type:      the type of the struct this is embedded in.
12 + * @member:    the name of the list_struct within the struct.
13 + *
14 + * Note, that list is expected to be not empty.
15 + */
16 +#define list_last_entry(ptr, type, member) \
17 +       list_entry((ptr)->prev, type, member)
18 +#endif
19 +
20  #endif /* __BACKPORT_LIST_H */