aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/list.h
diff options
context:
space:
mode:
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 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,
544 &pos->member != (head); \ 544 &pos->member != (head); \
545 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 545 pos = n, n = list_entry(n->member.prev, typeof(*n), member))
546 546
547/**
548 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
549 * @pos: the loop cursor used in the list_for_each_entry_safe loop
550 * @n: temporary storage used in list_for_each_entry_safe
551 * @member: the name of the list_struct within the struct.
552 *
553 * list_safe_reset_next is not safe to use in general if the list may be
554 * modified concurrently (eg. the lock is dropped in the loop body). An
555 * exception to this is if the cursor element (pos) is pinned in the list,
556 * and list_safe_reset_next is called after re-taking the lock and before
557 * completing the current iteration of the loop body.
558 */
559#define list_safe_reset_next(pos, n, member) \
560 n = list_entry(pos->member.next, typeof(*pos), member)
561
547/* 562/*
548 * Double linked lists with a single pointer list head. 563 * Double linked lists with a single pointer list head.
549 * Mostly useful for hash tables where the two pointer list head is 564 * Mostly useful for hash tables where the two pointer list head is