Add STATIC_LIST initializer
authorGeoff Levand <geoff@infradead.org>
Sat, 12 Nov 2011 06:28:50 +0000 (22:28 -0800)
committerGeoff Levand <geoff@infradead.org>
Sat, 12 Nov 2011 06:28:50 +0000 (22:28 -0800)
Signed-off-by: Geoff Levand <geoff@infradead.org>
lib/list/list.h

index 53080a034a16bf34dc9042d085f81016f6823864..c8c56318a340b834e99d70fcca96e2cce544db22 100644 (file)
@@ -34,6 +34,13 @@ struct list {
        for (; &_pos->_member != &(_list)->head; \
                _pos = list_entry(_pos->_member.next, typeof(*_pos), _member))
 
+#define STATIC_LIST(_list) static struct list _list = { \
+       .head = { \
+               .next = &_list.head, \
+               .prev = &_list.head \
+       } \
+}
+
 void list_init(struct list *list);
 void list_insert_before(struct list_item *next, struct list_item *item);
 void list_insert_after(struct list_item *prev, struct list_item *item);