From: Johannes Berg <johannes.berg@xxxxxxxxx> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- backport/backport-include/linux/list.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 backport/backport-include/linux/list.h diff --git a/backport/backport-include/linux/list.h b/backport/backport-include/linux/list.h new file mode 100644 index 000000000000..8495fd419a95 --- /dev/null +++ b/backport/backport-include/linux/list.h @@ -0,0 +1,19 @@ +#ifndef __BP_LINUX_LIST_H +#define __BP_LINUX_LIST_H +#include_next <linux/list.h> + +#if LINUX_VERSION_IS_LESS(6,3,0) +#define list_count_nodes LINUX_BACKPORT(list_count_nodes) +static inline size_t list_count_nodes(struct list_head *head) +{ + struct list_head *pos; + size_t count = 0; + + list_for_each(pos, head) + count++; + + return count; +} +#endif + +#endif /* __BP_LINUX_LIST_H */ -- 2.45.1