[PATCH] uml: move tty logging to os-Linux
[powerpc.git] / include / asm-sparc64 / atomic.h
index 25256bd..468eb48 100644 (file)
@@ -78,9 +78,15 @@ extern int atomic64_sub_ret(int, atomic64_t *);
 ({                                                             \
        int c, old;                                             \
        c = atomic_read(v);                                     \
-       while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
+       for (;;) {                                              \
+               if (unlikely(c == (u)))                         \
+                       break;                                  \
+               old = atomic_cmpxchg((v), c, c + (a));          \
+               if (likely(old == c))                           \
+                       break;                                  \
                c = old;                                        \
-       c != (u);                                               \
+       }                                                       \
+       likely(c != (u));                                       \
 })
 #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)