summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2015-04-29 08:38:45 -0400
committerRob Clark <[email protected]>2015-06-21 07:52:36 -0400
commitc79b2e626c60a29f684bc389f07a712b59fa99cc (patch)
treefc7f951bb7c6bbb610975baafad76a1d2254bec0 /src/util
parentb3d2e367167b675c0b402c90220f40f8cd567d7c (diff)
util/list: add list_first/last_entry
I need an easier way to get at head/tail in ir3. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/list.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util/list.h b/src/util/list.h
index 946034710ef..b98ce59ff77 100644
--- a/src/util/list.h
+++ b/src/util/list.h
@@ -140,6 +140,13 @@ static inline void list_validate(struct list_head *list)
- ((char *)&(sample)->member - (char *)(sample)))
#endif
+#define list_first_entry(ptr, type, member) \
+ LIST_ENTRY(type, (ptr)->next, member)
+
+#define list_last_entry(ptr, type, member) \
+ LIST_ENTRY(type, (ptr)->prev, member)
+
+
#define LIST_FOR_EACH_ENTRY(pos, head, member) \
for (pos = NULL, pos = container_of((head)->next, pos, member); \
&pos->member != (head); \