summaryrefslogtreecommitdiff
path: root/arch/alpha
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2023-04-05 17:17:08 +0300
committerIngo Molnar <mingo@kernel.org>2023-04-29 10:09:16 +0300
commitd994f2c8e2410ebcb928df67baa6f04e29bc9d3e (patch)
treed410609c74e79e17a758aec1be8e043603be8e61 /arch/alpha
parent8fc4fddaf9a184eea7da21290236a1764e608a01 (diff)
downloadlinux-d994f2c8e2410ebcb928df67baa6f04e29bc9d3e.tar.xz
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.h12
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)))
/**