aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/llist.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/include/linux/llist.h b/include/linux/llist.h
index 3e2b969d68f6..cdaa7f023899 100644
--- a/include/linux/llist.h
+++ b/include/linux/llist.h
@@ -142,6 +142,9 @@ static inline struct llist_node *llist_next(struct llist_node *node)
142 return node->next; 142 return node->next;
143} 143}
144 144
145extern bool llist_add_batch(struct llist_node *new_first,
146 struct llist_node *new_last,
147 struct llist_head *head);
145/** 148/**
146 * llist_add - add a new entry 149 * llist_add - add a new entry
147 * @new: new entry to be added 150 * @new: new entry to be added
@@ -151,13 +154,7 @@ static inline struct llist_node *llist_next(struct llist_node *node)
151 */ 154 */
152static inline bool llist_add(struct llist_node *new, struct llist_head *head) 155static inline bool llist_add(struct llist_node *new, struct llist_head *head)
153{ 156{
154 struct llist_node *first; 157 return llist_add_batch(new, new, head);
155
156 do {
157 new->next = first = ACCESS_ONCE(head->first);
158 } while (cmpxchg(&head->first, first, new) != first);
159
160 return !first;
161} 158}
162 159
163/** 160/**
@@ -173,9 +170,6 @@ static inline struct llist_node *llist_del_all(struct llist_head *head)
173 return xchg(&head->first, NULL); 170 return xchg(&head->first, NULL);
174} 171}
175 172
176extern bool llist_add_batch(struct llist_node *new_first,
177 struct llist_node *new_last,
178 struct llist_head *head);
179extern struct llist_node *llist_del_first(struct llist_head *head); 173extern struct llist_node *llist_del_first(struct llist_head *head);
180 174
181#endif /* LLIST_H */ 175#endif /* LLIST_H */