diff options
author | Jiri Pirko <jiri@mellanox.com> | 2017-02-03 10:29:05 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-03 16:35:42 -0500 |
commit | b862815c3ee7b49ec20a9ab25da55a5f0bcbb95e (patch) | |
tree | 51e6e326d62f70ec1aac5c687fbf89f8351d116c /include/linux/list.h | |
parent | 8708ecf01d454607f15fe1b378c8b88de3b9c34b (diff) | |
download | linux-rt-b862815c3ee7b49ec20a9ab25da55a5f0bcbb95e.tar.gz |
list: introduce list_for_each_entry_from_reverse helper
Similar to list_for_each_entry_continue and its reverse variant
list_for_each_entry_continue_reverse, introduce reverse helper for
list_for_each_entry_from.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index d1039ecaf94f..ae537fa46216 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -527,6 +527,19 @@ static inline void list_splice_tail_init(struct list_head *list, pos = list_next_entry(pos, member)) /** + * list_for_each_entry_from_reverse - iterate backwards over list of given type + * from the current point + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_head within the struct. + * + * Iterate backwards over list of given type, continuing from current position. + */ +#define list_for_each_entry_from_reverse(pos, head, member) \ + for (; &pos->member != (head); \ + pos = list_prev_entry(pos, member)) + +/** * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry * @pos: the type * to use as a loop cursor. * @n: another type * to use as temporary storage |