[PATCH i-g-t v30 01/37] lib/igt_list: Add igt_list_del_init()
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Fri Mar 26 07:56:14 UTC 2021
Add helper function for delete and reinitialize list element.
Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Petri Latvala <petri.latvala at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
lib/igt_list.c | 6 ++++++
lib/igt_list.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/lib/igt_list.c b/lib/igt_list.c
index 5e30b19b6..37ae139c4 100644
--- a/lib/igt_list.c
+++ b/lib/igt_list.c
@@ -46,6 +46,12 @@ void igt_list_del(struct igt_list_head *elem)
elem->prev = NULL;
}
+void igt_list_del_init(struct igt_list_head *elem)
+{
+ igt_list_del(elem);
+ IGT_INIT_LIST_HEAD(elem);
+}
+
void igt_list_move(struct igt_list_head *elem, struct igt_list_head *list)
{
igt_list_del(elem);
diff --git a/lib/igt_list.h b/lib/igt_list.h
index dbf5f802c..cc93d7a0d 100644
--- a/lib/igt_list.h
+++ b/lib/igt_list.h
@@ -75,6 +75,7 @@ struct igt_list_head {
void IGT_INIT_LIST_HEAD(struct igt_list_head *head);
void igt_list_add(struct igt_list_head *elem, struct igt_list_head *head);
void igt_list_del(struct igt_list_head *elem);
+void igt_list_del_init(struct igt_list_head *elem);
void igt_list_move(struct igt_list_head *elem, struct igt_list_head *list);
void igt_list_move_tail(struct igt_list_head *elem, struct igt_list_head *list);
int igt_list_length(const struct igt_list_head *head);
--
2.26.0
More information about the Intel-gfx-trybot
mailing list