[igt-dev] [PATCH i-g-t v29 02/36] lib/igt_list: Add igt_list_for_each_entry_safe_reverse
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Wed Mar 24 17:35:05 UTC 2021
From: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Added safe version of reversed iteration over igt_list.
Signed-off-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>
Cc: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
lib/igt_list.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/igt_list.h b/lib/igt_list.h
index cc93d7a0d..be63fd806 100644
--- a/lib/igt_list.h
+++ b/lib/igt_list.h
@@ -108,6 +108,12 @@ bool igt_list_empty(const struct igt_list_head *head);
&pos->member != (head); \
pos = igt_container_of((pos)->member.prev, pos, member))
+#define igt_list_for_each_entry_safe_reverse(pos, tmp, head, member) \
+ for (pos = igt_container_of((head)->prev, pos, member), \
+ tmp = igt_container_of((pos)->member.prev, tmp, member); \
+ &pos->member != (head); \
+ pos = tmp, \
+ tmp = igt_container_of((pos)->member.prev, tmp, member))
/* IGT custom helpers */
--
2.26.0
More information about the igt-dev
mailing list