[PATCH 1/2] linux/list.h: Add list_is_first()

Romain Gantois romain.gantois at bootlin.com
Thu Jun 25 11:05:25 CEST 2026


Include the list_is_first() kernel function, which will be used by the
Renesas USBF driver.

Signed-off-by: Romain Gantois <romain.gantois at bootlin.com>
---
 include/linux/list.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/list.h b/include/linux/list.h
index 3dc38279716..dc788b1cb69 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -153,6 +153,16 @@ static inline void list_move_tail(struct list_head *list,
 	list_add_tail(list, head);
 }
 
+/**
+ * list_is_first -- tests whether @list is the first entry in list @head
+ * @list: the entry to test
+ * @head: the head of the list
+ */
+static inline int list_is_first(const struct list_head *list, const struct list_head *head)
+{
+	return list->prev == head;
+}
+
 /**
  * list_is_last - tests whether @list is the last entry in list @head
  * @list: the entry to test

-- 
2.54.0



More information about the U-Boot mailing list