llist: Move cpu_relax() to after the cmpxchg()
[platform/adaptation/renesas_rcar/renesas_kernel.git] / include / linux / llist.h
index 65fca1c..ca91875 100644 (file)
@@ -148,11 +148,14 @@ static inline void llist_add(struct llist_node *new, struct llist_head *head)
        struct llist_node *entry, *old_entry;
 
        entry = head->first;
-       do {
+       for (;;) {
                old_entry = entry;
                new->next = entry;
+               entry = cmpxchg(&head->first, old_entry, new);
+               if (entry == old_entry)
+                       break;
                cpu_relax();
-       } while ((entry = cmpxchg(&head->first, old_entry, new)) != old_entry);
+       }
 }
 
 /**