diff options
Diffstat (limited to 'include/asm-xtensa')
-rw-r--r-- | include/asm-xtensa/atomic.h | 23 | ||||
-rw-r--r-- | include/asm-xtensa/kdebug.h | 1 | ||||
-rw-r--r-- | include/asm-xtensa/system.h | 2 |
3 files changed, 16 insertions, 10 deletions
diff --git a/include/asm-xtensa/atomic.h b/include/asm-xtensa/atomic.h index 5c267202106..b3b23540f14 100644 --- a/include/asm-xtensa/atomic.h +++ b/include/asm-xtensa/atomic.h @@ -234,14 +234,21 @@ static inline int atomic_sub_return(int i, atomic_t * v) * Atomically adds @a to @v, so long as it was not @u. * Returns non-zero if @v was not @u, and zero otherwise. */ -#define atomic_add_unless(v, a, u) \ -({ \ - int c, old; \ - c = atomic_read(v); \ - while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ - c = old; \ - c != (u); \ -}) +static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) +{ + int c, old; + c = atomic_read(v); + for (;;) { + if (unlikely(c == (u))) + break; + old = atomic_cmpxchg((v), c, c + (a)); + if (likely(old == c)) + break; + c = old; + } + return c != (u); +} + #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) diff --git a/include/asm-xtensa/kdebug.h b/include/asm-xtensa/kdebug.h new file mode 100644 index 00000000000..6ece1b03766 --- /dev/null +++ b/include/asm-xtensa/kdebug.h @@ -0,0 +1 @@ +#include <asm-generic/kdebug.h> diff --git a/include/asm-xtensa/system.h b/include/asm-xtensa/system.h index 4aaed7fe6cf..ddc970847ae 100644 --- a/include/asm-xtensa/system.h +++ b/include/asm-xtensa/system.h @@ -183,8 +183,6 @@ static inline unsigned long xchg_u32(volatile int * m, unsigned long val) return tmp; } -#define tas(ptr) (xchg((ptr),1)) - #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) /* |