xref: /linux/drivers/gpu/drm/i915/i915_list_util.h (revision 55a42f78ffd386e01a5404419f8c5ded7db70a21)
1 /* SPDX-License-Identifier: MIT */
2 /* Copyright © 2025 Intel Corporation */
3 
4 #ifndef __I915_LIST_UTIL_H__
5 #define __I915_LIST_UTIL_H__
6 
7 #include <linux/list.h>
8 #include <asm/rwonce.h>
9 
10 static inline void __list_del_many(struct list_head *head,
11 				   struct list_head *first)
12 {
13 	first->prev = head;
14 	WRITE_ONCE(head->next, first);
15 }
16 
17 static inline int list_is_last_rcu(const struct list_head *list,
18 				   const struct list_head *head)
19 {
20 	return READ_ONCE(list->next) == head;
21 }
22 
23 #endif /* __I915_LIST_UTIL_H__ */
24