diff options
author | 2006-01-09 20:51:31 -0800 | |
---|---|---|
committer | 2006-01-10 08:01:24 -0800 | |
commit | 0ad42352c01788e41a33336577fdd270d8de55bb (patch) | |
tree | c7597bbb7d3f5f6fd3a9c359c0b882d0d8ad8bd8 /include/linux/list.h | |
parent | [PATCH] i386: GPIO driver for AMD CS5535/CS5536 (diff) | |
download | linux-0ad42352c01788e41a33336577fdd270d8de55bb.tar.gz linux-0ad42352c01788e41a33336577fdd270d8de55bb.tar.bz2 linux-0ad42352c01788e41a33336577fdd270d8de55bb.zip |
[PATCH] Add list_for_each_entry_safe_reverse()
Add list_for_each_entry_safe_reverse() to linux/list.h
This is needed by unmerged cachefs and be an as-yet-unreviewed
device_shutdown() fix.
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Patrick Mochel <mochel@digitalimplant.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index 8e3388284530..945daa1f13dd 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -436,6 +436,20 @@ static inline void list_splice_init(struct list_head *list, pos = n, n = list_entry(n->member.next, typeof(*n), member)) /** + * list_for_each_entry_safe_reverse - iterate backwards over list of given type safe against + * removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + n = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + +/** * list_for_each_rcu - iterate over an rcu-protected list * @pos: the &struct list_head to use as a loop counter. * @head: the head for your list. |