6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in
14 * the documentation and/or other materials provided with the
16 * * Neither the name of NXP nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41 struct list_head *prev;
42 struct list_head *next;
45 #define COMPAT_LIST_HEAD(n) \
46 struct list_head n = { \
51 #define INIT_LIST_HEAD(p) \
53 struct list_head *__p298 = (p); \
54 __p298->next = __p298; \
55 __p298->prev = __p298->next; \
57 #define list_entry(node, type, member) \
58 (type *)((void *)node - offsetof(type, member))
59 #define list_empty(p) \
61 const struct list_head *__p298 = (p); \
62 ((__p298->next == __p298) && (__p298->prev == __p298)); \
64 #define list_add(p, l) \
66 struct list_head *__p298 = (p); \
67 struct list_head *__l298 = (l); \
68 __p298->next = __l298->next; \
69 __p298->prev = __l298; \
70 __l298->next->prev = __p298; \
71 __l298->next = __p298; \
73 #define list_add_tail(p, l) \
75 struct list_head *__p298 = (p); \
76 struct list_head *__l298 = (l); \
77 __p298->prev = __l298->prev; \
78 __p298->next = __l298; \
79 __l298->prev->next = __p298; \
80 __l298->prev = __p298; \
82 #define list_for_each(i, l) \
83 for (i = (l)->next; i != (l); i = i->next)
84 #define list_for_each_safe(i, j, l) \
85 for (i = (l)->next, j = i->next; i != (l); \
87 #define list_for_each_entry(i, l, name) \
88 for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \
89 i = list_entry(i->name.next, typeof(*i), name))
90 #define list_for_each_entry_safe(i, j, l, name) \
91 for (i = list_entry((l)->next, typeof(*i), name), \
92 j = list_entry(i->name.next, typeof(*j), name); \
94 i = j, j = list_entry(j->name.next, typeof(*j), name))
97 (i)->next->prev = (i)->prev; \
98 (i)->prev->next = (i)->next; \
101 #endif /* __DPAA_LIST_H */