mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 04:33:26 +02:00
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>
This commit is contained in:
@@ -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)))
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user