diff options
Diffstat (limited to 'include/asm-i386')
-rw-r--r-- | include/asm-i386/atomic.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/asm-i386/atomic.h b/include/asm-i386/atomic.h index 78b0032d1f29..22d80ece95cb 100644 --- a/include/asm-i386/atomic.h +++ b/include/asm-i386/atomic.h | |||
@@ -225,8 +225,14 @@ static __inline__ int atomic_sub_return(int i, atomic_t *v) | |||
225 | ({ \ | 225 | ({ \ |
226 | int c, old; \ | 226 | int c, old; \ |
227 | c = atomic_read(v); \ | 227 | c = atomic_read(v); \ |
228 | while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ | 228 | for (;;) { \ |
229 | if (unlikely(c == (u))) \ | ||
230 | break; \ | ||
231 | old = atomic_cmpxchg((v), c, c + (a)); \ | ||
232 | if (likely(old == c)) \ | ||
233 | break; \ | ||
229 | c = old; \ | 234 | c = old; \ |
235 | } \ | ||
230 | c != (u); \ | 236 | c != (u); \ |
231 | }) | 237 | }) |
232 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) | 238 | #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) |