summaryrefslogtreecommitdiffstats
path: root/include/linux/list.h
diff options
context:
space:
mode:
authorChris Metcalf2010-07-06 19:45:24 +0200
committerChris Metcalf2010-07-06 19:45:24 +0200
commita2262d8a231e92742651859a10c9a4430a5e899a (patch)
treeb5a823e3f6a3f60e1dd995f113caf0b350228d84 /include/linux/list.h
parentarch/tile: catch up on various minor cleanups. (diff)
parentLinux 2.6.35-rc4 (diff)
downloadkernel-qcow2-linux-a2262d8a231e92742651859a10c9a4430a5e899a.tar.gz
kernel-qcow2-linux-a2262d8a231e92742651859a10c9a4430a5e899a.tar.xz
kernel-qcow2-linux-a2262d8a231e92742651859a10c9a4430a5e899a.zip
Merge branch 'master' into for-linus
Diffstat (limited to 'include/linux/list.h')
-rw-r--r--include/linux/list.h15
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