[PATCH v2 11/20] include: asm-generic/atomic.h: define atomic_cmpxchg
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Nov 22 09:29:42 PST 2023
We already define a generic cmpxchg implementation, so add one that
operates on atomic_t as well.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
v1 -> v2:
- unchanged
---
include/asm-generic/atomic.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h
index 27b0f73b487b..74429e1c373f 100644
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -116,6 +116,8 @@ static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
*addr &= ~mask;
}
+#define atomic_cmpxchg(v, o, n) cmpxchg(&((v)->counter), o, n)
+
/* Atomic operations are already serializing on ARM */
#define smp_mb__before_atomic_dec() barrier()
#define smp_mb__after_atomic_dec() barrier()
--
2.39.2
More information about the barebox
mailing list