From 33e0de57cd314b7620e2755d0f69080f56081cc3 Mon Sep 17 00:00:00 2001 From: Huang Ying Date: Thu, 8 Sep 2011 14:00:45 +0800 Subject: [PATCH] --- yaml --- r: 269166 b: refs/heads/master c: 781f7fd916fc77a862e20063ed3aeedf173234f9 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/llist.h | 6 +++++- trunk/lib/llist.c | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 1c6fc8642911..0aeb448593ba 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a3127336b71f6833d1483c856dce91fe558dc3a9 +refs/heads/master: 781f7fd916fc77a862e20063ed3aeedf173234f9 diff --git a/trunk/include/linux/llist.h b/trunk/include/linux/llist.h index ca91875286bf..27bbdf5ddf82 100644 --- a/trunk/include/linux/llist.h +++ b/trunk/include/linux/llist.h @@ -142,8 +142,10 @@ static inline bool llist_empty(const struct llist_head *head) * llist_add - add a new entry * @new: new entry to be added * @head: the head for your lock-less list + * + * Return whether list is empty before adding. */ -static inline void llist_add(struct llist_node *new, struct llist_head *head) +static inline bool llist_add(struct llist_node *new, struct llist_head *head) { struct llist_node *entry, *old_entry; @@ -156,6 +158,8 @@ static inline void llist_add(struct llist_node *new, struct llist_head *head) break; cpu_relax(); } + + return old_entry == NULL; } /** diff --git a/trunk/lib/llist.c b/trunk/lib/llist.c index 6c69f1d14c4b..878985c4d19d 100644 --- a/trunk/lib/llist.c +++ b/trunk/lib/llist.c @@ -34,8 +34,10 @@ * @new_first: first entry in batch to be added * @new_last: last entry in batch to be added * @head: the head for your lock-less list + * + * Return whether list is empty before adding. */ -void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, +bool llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, struct llist_head *head) { struct llist_node *entry, *old_entry; @@ -49,6 +51,8 @@ void llist_add_batch(struct llist_node *new_first, struct llist_node *new_last, break; cpu_relax(); } + + return old_entry == NULL; } EXPORT_SYMBOL_GPL(llist_add_batch);