diff options
| author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-07-27 10:42:48 +0100 |
|---|---|---|
| committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-07-27 10:42:52 +0100 |
| commit | 4708ac49305bbcd511600d4af71a4c6dca15af65 (patch) | |
| tree | 77ba5c83a7d4f4a119e3fd524d82adc297df1e35 /include/linux/list.h | |
| parent | 1dbd30e9890fd69e50b17edd70ca583546b0fe4e (diff) | |
| parent | 2f7989efd4398d92b8adffce2e07dd043a0895fe (diff) | |
| download | cachepc-linux-4708ac49305bbcd511600d4af71a4c6dca15af65.tar.gz cachepc-linux-4708ac49305bbcd511600d4af71a4c6dca15af65.zip | |
Merge branch 'origin' into misc
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 8392884a2977..5d57a3a1fa1b 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -544,6 +544,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 |
