diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2024-04-10 08:29:36 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2024-04-10 15:04:55 +0200 |
commit | 21689e4bfb9ae8f8b45279c53faecaa5a056ffa5 (patch) | |
tree | d73b2d30b3158bfa9ddf08bcae7094ff71af8b4f /arch/x86/include/asm/atomic.h | |
parent | locking/atomic/x86: Rewrite x86_32 arch_atomic64_{,fetch}_{and,or,xor}() func... (diff) | |
download | linux-21689e4bfb9ae8f8b45279c53faecaa5a056ffa5.tar.xz linux-21689e4bfb9ae8f8b45279c53faecaa5a056ffa5.zip |
locking/atomic/x86: Define arch_atomic_sub() family using arch_atomic_add() functions
There is no need to implement arch_atomic_sub() family of inline
functions, corresponding macros can be directly implemented using
arch_atomic_add() inlines with negated argument.
No functional changes intended.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20240410062957.322614-4-ubizjak@gmail.com
Diffstat (limited to 'arch/x86/include/asm/atomic.h')
-rw-r--r-- | arch/x86/include/asm/atomic.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index 55a55ec04350..55b4d24356ea 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h @@ -86,11 +86,7 @@ static __always_inline int arch_atomic_add_return(int i, atomic_t *v) } #define arch_atomic_add_return arch_atomic_add_return -static __always_inline int arch_atomic_sub_return(int i, atomic_t *v) -{ - return arch_atomic_add_return(-i, v); -} -#define arch_atomic_sub_return arch_atomic_sub_return +#define arch_atomic_sub_return(i, v) arch_atomic_add_return(-(i), v) static __always_inline int arch_atomic_fetch_add(int i, atomic_t *v) { @@ -98,11 +94,7 @@ static __always_inline int arch_atomic_fetch_add(int i, atomic_t *v) } #define arch_atomic_fetch_add arch_atomic_fetch_add -static __always_inline int arch_atomic_fetch_sub(int i, atomic_t *v) -{ - return xadd(&v->counter, -i); -} -#define arch_atomic_fetch_sub arch_atomic_fetch_sub +#define arch_atomic_fetch_sub(i, v) arch_atomic_fetch_add(-(i), v) static __always_inline int arch_atomic_cmpxchg(atomic_t *v, int old, int new) { |