aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/list.h
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2013-03-19 04:47:30 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-03-19 04:47:30 -0400
commit0d4a42f6bd298e826620585e766a154ab460617a (patch)
tree406d8f7778691d858dbe3e48e4bbb10e99c0a58a /include/linux/list.h
parentd62b4892f3d9f7dd2002e5309be10719d6805b0f (diff)
parenta937536b868b8369b98967929045f1df54234323 (diff)
Merge tag 'v3.9-rc3' into drm-intel-next-queued
Backmerge so that I can merge Imre Deak's coalesced sg entries fixes, which depend upon the new for_each_sg_page introduce in commit a321e91b6d73ed011ffceed384c40d2785cf723b Author: Imre Deak <imre.deak@intel.com> Date: Wed Feb 27 17:02:56 2013 -0800 lib/scatterlist: add simple page iterator The merge itself is just two trivial conflicts: Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r--include/linux/list.h51
1 files changed, 24 insertions, 27 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index cc6d2aa6b415..6a1f8df9144b 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -666,54 +666,51 @@ static inline void hlist_move_list(struct hlist_head *old,
666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ 666 for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \
667 pos = n) 667 pos = n)
668 668
669#define hlist_entry_safe(ptr, type, member) \
670 ({ typeof(ptr) ____ptr = (ptr); \
671 ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
672 })
673
669/** 674/**
670 * hlist_for_each_entry - iterate over list of given type 675 * hlist_for_each_entry - iterate over list of given type
671 * @tpos: the type * to use as a loop cursor. 676 * @pos: the type * to use as a loop cursor.
672 * @pos: the &struct hlist_node to use as a loop cursor.
673 * @head: the head for your list. 677 * @head: the head for your list.
674 * @member: the name of the hlist_node within the struct. 678 * @member: the name of the hlist_node within the struct.
675 */ 679 */
676#define hlist_for_each_entry(tpos, pos, head, member) \ 680#define hlist_for_each_entry(pos, head, member) \
677 for (pos = (head)->first; \ 681 for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
678 pos && \ 682 pos; \
679 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 683 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
680 pos = pos->next)
681 684
682/** 685/**
683 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point 686 * hlist_for_each_entry_continue - iterate over a hlist continuing after current point
684 * @tpos: the type * to use as a loop cursor. 687 * @pos: the type * to use as a loop cursor.
685 * @pos: the &struct hlist_node to use as a loop cursor.
686 * @member: the name of the hlist_node within the struct. 688 * @member: the name of the hlist_node within the struct.
687 */ 689 */
688#define hlist_for_each_entry_continue(tpos, pos, member) \ 690#define hlist_for_each_entry_continue(pos, member) \
689 for (pos = (pos)->next; \ 691 for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\
690 pos && \ 692 pos; \
691 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 693 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
692 pos = pos->next)
693 694
694/** 695/**
695 * hlist_for_each_entry_from - iterate over a hlist continuing from current point 696 * hlist_for_each_entry_from - iterate over a hlist continuing from current point
696 * @tpos: the type * to use as a loop cursor. 697 * @pos: the type * to use as a loop cursor.
697 * @pos: the &struct hlist_node to use as a loop cursor.
698 * @member: the name of the hlist_node within the struct. 698 * @member: the name of the hlist_node within the struct.
699 */ 699 */
700#define hlist_for_each_entry_from(tpos, pos, member) \ 700#define hlist_for_each_entry_from(pos, member) \
701 for (; pos && \ 701 for (; pos; \
702 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 702 pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
703 pos = pos->next)
704 703
705/** 704/**
706 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry 705 * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry
707 * @tpos: the type * to use as a loop cursor. 706 * @pos: the type * to use as a loop cursor.
708 * @pos: the &struct hlist_node to use as a loop cursor.
709 * @n: another &struct hlist_node to use as temporary storage 707 * @n: another &struct hlist_node to use as temporary storage
710 * @head: the head for your list. 708 * @head: the head for your list.
711 * @member: the name of the hlist_node within the struct. 709 * @member: the name of the hlist_node within the struct.
712 */ 710 */
713#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ 711#define hlist_for_each_entry_safe(pos, n, head, member) \
714 for (pos = (head)->first; \ 712 for (pos = hlist_entry_safe((head)->first, typeof(*pos), member);\
715 pos && ({ n = pos->next; 1; }) && \ 713 pos && ({ n = pos->member.next; 1; }); \
716 ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ 714 pos = hlist_entry_safe(n, typeof(*pos), member))
717 pos = n)
718 715
719#endif 716#endif