summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/list.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/list.h b/include/list.h
index cccc3c3..94ad99b 100644
--- a/include/list.h
+++ b/include/list.h
@@ -38,6 +38,12 @@ static inline int list_empty(const struct list_head *head)
#define list_entry(ptr, type, member) \
list_container_of(ptr, type, member)
+#define list_first_entry(ptr, type, member) \
+ list_entry((ptr)->next, type, member)
+
+#define list_first_entry_or_null(ptr, type, member) \
+ (!list_empty(ptr) ? list_first_entry(ptr, type, member) : NULL)
+
#define list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)