7e720e0f7a560ef072d38e56e2e8ea30fe6589c5
[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 @@ -88,4 +88,17 @@
4         list_entry((ptr)->prev, type, member)
5  #endif
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 */