[igt-dev] [PATCH i-g-t v19 01/34] lib/igt_list: Add igt_list_del_init()
Zbigniew Kempczyński
zbigniew.kempczynski at intel.com
Tue Feb 2 09:24:10 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>
---
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 igt-dev
mailing list