15typedef struct list_head
17 struct list_head *next, *prev;
20#define LIST_HEAD_INIT(name) { &(name), &(name) }
22#define LIST_HEAD(name) \
23 USB_LIST_T name = LIST_HEAD_INIT(name)
25#define INIT_LIST_HEAD(ptr) do { \
26 (ptr)->next = (ptr); (ptr)->prev = (ptr); \
36static __inline
void __list_add(USB_LIST_T *
new,
54static __inline
void list_add(USB_LIST_T *
new, USB_LIST_T *head)
56 __list_add(
new, head, head->next);
67static __inline
void list_add_tail(USB_LIST_T *
new, USB_LIST_T *head)
69 __list_add(
new, head->prev, head);
79static __inline
void __list_del(USB_LIST_T * prev,
91static __inline
void list_del(USB_LIST_T *entry)
93 __list_del(entry->prev, entry->next);
100static __inline
void list_del_init(USB_LIST_T *entry)
102 __list_del(entry->prev, entry->next);
103 INIT_LIST_HEAD(entry);
110static __inline
int list_empty(USB_LIST_T *head)
112 return head->next == head;
120static __inline
void list_splice(USB_LIST_T *list, USB_LIST_T *head)
122 USB_LIST_T *first = list->next;
126 USB_LIST_T *last = list->prev;
127 USB_LIST_T *at = head->next;
143#define list_entry(ptr, type, member) \
144 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
151#define list_for_each(pos, head) \
152 for (pos = (head)->next; pos != (head); pos = pos->next)
161#define list_for_each_safe(pos, n, head) \
162 for (pos = (head)->next, n = pos->next; pos != (head); \
163 pos = n, n = pos->next)
166static __inline
void __list_splice(
struct list_head *list,
struct list_head *head)
168 struct list_head *first = list->next;
169 struct list_head *last = list->prev;
170 struct list_head *at = head->next;
180static __inline
void list_move_tail(
struct list_head *list,
struct list_head *head)
182 __list_del(list->prev, list->next);
183 list_add_tail(list, head);
192static __inline
void list_move(
struct list_head *list,
struct list_head *head)
194 __list_del(list->prev, list->next);
195 list_add(list, head);