diff options
author | Uros Bizjak <ubizjak@gmail.com> | 2023-04-05 16:17:08 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2023-04-29 09:09:16 +0200 |
commit | d994f2c8e2410ebcb928df67baa6f04e29bc9d3e (patch) | |
tree | d410609c74e79e17a758aec1be8e043603be8e61 /arch/alpha | |
parent | locking/generic: Wire up local{,64}_try_cmpxchg() (diff) | |
download | linux-d994f2c8e2410ebcb928df67baa6f04e29bc9d3e.tar.xz linux-d994f2c8e2410ebcb928df67baa6f04e29bc9d3e.zip |
locking/arch: Wire up local_try_cmpxchg()
Implement target specific support for local_try_cmpxchg()
and local_cmpxchg() using typed C wrappers that call their
_local counterpart and provide additional checking of
their input arguments.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230405141710.3551-4-ubizjak@gmail.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/alpha')
-rw-r--r-- | arch/alpha/include/asm/local.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/arch/alpha/include/asm/local.h b/arch/alpha/include/asm/local.h index fab26a1c93d5..0fcaad642cc3 100644 --- a/arch/alpha/include/asm/local.h +++ b/arch/alpha/include/asm/local.h @@ -52,8 +52,16 @@ static __inline__ long local_sub_return(long i, local_t * l) return result; } -#define local_cmpxchg(l, o, n) \ - (cmpxchg_local(&((l)->a.counter), (o), (n))) +static __inline__ long local_cmpxchg(local_t *l, long old, long new) +{ + return cmpxchg_local(&l->a.counter, old, new); +} + +static __inline__ bool local_try_cmpxchg(local_t *l, long *old, long new) +{ + return try_cmpxchg_local(&l->a.counter, (s64 *)old, new); +} + #define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n))) /** |