|
@@ -209,82 +209,6 @@ ATOMIC_OPS(xor, xor, i)
|
|
|
#undef ATOMIC_FETCH_OP
|
|
|
#undef ATOMIC_OP_RETURN
|
|
|
|
|
|
-#define ATOMIC_OP(op, func_op, I, c_type, prefix) \
|
|
|
-static __always_inline \
|
|
|
-void atomic##prefix##_##op(atomic##prefix##_t *v) \
|
|
|
-{ \
|
|
|
- atomic##prefix##_##func_op(I, v); \
|
|
|
-}
|
|
|
-
|
|
|
-#define ATOMIC_FETCH_OP(op, func_op, I, c_type, prefix) \
|
|
|
-static __always_inline \
|
|
|
-c_type atomic##prefix##_fetch_##op##_relaxed(atomic##prefix##_t *v) \
|
|
|
-{ \
|
|
|
- return atomic##prefix##_fetch_##func_op##_relaxed(I, v); \
|
|
|
-} \
|
|
|
-static __always_inline \
|
|
|
-c_type atomic##prefix##_fetch_##op(atomic##prefix##_t *v) \
|
|
|
-{ \
|
|
|
- return atomic##prefix##_fetch_##func_op(I, v); \
|
|
|
-}
|
|
|
-
|
|
|
-#define ATOMIC_OP_RETURN(op, asm_op, c_op, I, c_type, prefix) \
|
|
|
-static __always_inline \
|
|
|
-c_type atomic##prefix##_##op##_return_relaxed(atomic##prefix##_t *v) \
|
|
|
-{ \
|
|
|
- return atomic##prefix##_fetch_##op##_relaxed(v) c_op I; \
|
|
|
-} \
|
|
|
-static __always_inline \
|
|
|
-c_type atomic##prefix##_##op##_return(atomic##prefix##_t *v) \
|
|
|
-{ \
|
|
|
- return atomic##prefix##_fetch_##op(v) c_op I; \
|
|
|
-}
|
|
|
-
|
|
|
-#ifdef CONFIG_GENERIC_ATOMIC64
|
|
|
-#define ATOMIC_OPS(op, asm_op, c_op, I) \
|
|
|
- ATOMIC_OP( op, asm_op, I, int, ) \
|
|
|
- ATOMIC_FETCH_OP( op, asm_op, I, int, ) \
|
|
|
- ATOMIC_OP_RETURN(op, asm_op, c_op, I, int, )
|
|
|
-#else
|
|
|
-#define ATOMIC_OPS(op, asm_op, c_op, I) \
|
|
|
- ATOMIC_OP( op, asm_op, I, int, ) \
|
|
|
- ATOMIC_FETCH_OP( op, asm_op, I, int, ) \
|
|
|
- ATOMIC_OP_RETURN(op, asm_op, c_op, I, int, ) \
|
|
|
- ATOMIC_OP( op, asm_op, I, long, 64) \
|
|
|
- ATOMIC_FETCH_OP( op, asm_op, I, long, 64) \
|
|
|
- ATOMIC_OP_RETURN(op, asm_op, c_op, I, long, 64)
|
|
|
-#endif
|
|
|
-
|
|
|
-ATOMIC_OPS(inc, add, +, 1)
|
|
|
-ATOMIC_OPS(dec, add, +, -1)
|
|
|
-
|
|
|
-#define atomic_inc_return_relaxed atomic_inc_return_relaxed
|
|
|
-#define atomic_dec_return_relaxed atomic_dec_return_relaxed
|
|
|
-#define atomic_inc_return atomic_inc_return
|
|
|
-#define atomic_dec_return atomic_dec_return
|
|
|
-
|
|
|
-#define atomic_fetch_inc_relaxed atomic_fetch_inc_relaxed
|
|
|
-#define atomic_fetch_dec_relaxed atomic_fetch_dec_relaxed
|
|
|
-#define atomic_fetch_inc atomic_fetch_inc
|
|
|
-#define atomic_fetch_dec atomic_fetch_dec
|
|
|
-
|
|
|
-#ifndef CONFIG_GENERIC_ATOMIC64
|
|
|
-#define atomic64_inc_return_relaxed atomic64_inc_return_relaxed
|
|
|
-#define atomic64_dec_return_relaxed atomic64_dec_return_relaxed
|
|
|
-#define atomic64_inc_return atomic64_inc_return
|
|
|
-#define atomic64_dec_return atomic64_dec_return
|
|
|
-
|
|
|
-#define atomic64_fetch_inc_relaxed atomic64_fetch_inc_relaxed
|
|
|
-#define atomic64_fetch_dec_relaxed atomic64_fetch_dec_relaxed
|
|
|
-#define atomic64_fetch_inc atomic64_fetch_inc
|
|
|
-#define atomic64_fetch_dec atomic64_fetch_dec
|
|
|
-#endif
|
|
|
-
|
|
|
-#undef ATOMIC_OPS
|
|
|
-#undef ATOMIC_OP
|
|
|
-#undef ATOMIC_FETCH_OP
|
|
|
-#undef ATOMIC_OP_RETURN
|
|
|
-
|
|
|
/* This is required to provide a full barrier on success. */
|
|
|
static __always_inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
|
|
|
{
|