fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / asm-sparc64 / atomic.h
index 25256bd..2f0bec2 100644 (file)
@@ -8,7 +8,6 @@
 #ifndef __ARCH_SPARC64_ATOMIC__
 #define __ARCH_SPARC64_ATOMIC__
 
-#include <linux/config.h>
 #include <linux/types.h>
 
 typedef struct { volatile int counter; } atomic_t;
@@ -78,9 +77,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)