diff options
Diffstat (limited to 'include/asm-sparc64/atomic.h')
-rw-r--r-- | include/asm-sparc64/atomic.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/asm-sparc64/atomic.h b/include/asm-sparc64/atomic.h index 25256bdc8aae..468eb48d8142 100644 --- a/include/asm-sparc64/atomic.h +++ b/include/asm-sparc64/atomic.h | |||
@@ -78,9 +78,15 @@ extern int atomic64_sub_ret(int, atomic64_t *); | |||
78 | ({ \ | 78 | ({ \ |
79 | int c, old; \ | 79 | int c, old; \ |
80 | c = atomic_read(v); \ | 80 | c = atomic_read(v); \ |
81 | while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ | 81 | for (;;) { \ |
82 | if (unlikely(c == (u))) \ | ||
83 | break; \ | ||
84 | old = atomic_cmpxchg((v), c, c + (a)); \ | ||
85 | if (likely(old == c)) \ | ||
86 | break; \ | ||
82 | c = old; \ | 87 | c = old; \ |
83 | c != (u); \ | 88 | } \ |
89 | likely(c != (u)); \ | ||
84 | }) | 90 | }) |
85 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 91 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |
86 | 92 | ||