diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2010-07-06 21:45:24 +0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-07-06 21:45:24 +0400 |
commit | a2262d8a231e92742651859a10c9a4430a5e899a (patch) | |
tree | b5a823e3f6a3f60e1dd995f113caf0b350228d84 /include/linux/list.h | |
parent | ef06f55a5c936a395f3ee2e1237bbebdb4396c65 (diff) | |
parent | 815c4163b6c8ebf8152f42b0a5fd015cfdcedc78 (diff) | |
download | linux-a2262d8a231e92742651859a10c9a4430a5e899a.tar.xz |
Merge branch 'master' into for-linus
Diffstat (limited to 'include/linux/list.h')
-rw-r--r-- | include/linux/list.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index bc43e8a0d7f6..d167b5d7c0ac 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -541,6 +541,21 @@ static inline void list_splice_tail_init(struct list_head *list, &pos->member != (head); \ pos = n, n = list_entry(n->member.prev, typeof(*n), member)) +/** + * list_safe_reset_next - reset a stale list_for_each_entry_safe loop + * @pos: the loop cursor used in the list_for_each_entry_safe loop + * @n: temporary storage used in list_for_each_entry_safe + * @member: the name of the list_struct within the struct. + * + * list_safe_reset_next is not safe to use in general if the list may be + * modified concurrently (eg. the lock is dropped in the loop body). An + * exception to this is if the cursor element (pos) is pinned in the list, + * and list_safe_reset_next is called after re-taking the lock and before + * completing the current iteration of the loop body. + */ +#define list_safe_reset_next(pos, n, member) \ + n = list_entry(pos->member.next, typeof(*pos), member) + /* * Double linked lists with a single pointer list head. * Mostly useful for hash tables where the two pointer list head is |