1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_SCORE_CMPXCHG_H
3 #define _ASM_SCORE_CMPXCHG_H
5 #include <linux/irqflags.h>
7 struct __xchg_dummy
{ unsigned long a
[100]; };
8 #define __xg(x) ((struct __xchg_dummy *)(x))
11 unsigned long __xchg(volatile unsigned long *m
, unsigned long val
)
16 local_irq_save(flags
);
19 local_irq_restore(flags
);
23 #define xchg(ptr, v) \
24 ((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \
27 static inline unsigned long __cmpxchg(volatile unsigned long *m
,
28 unsigned long old
, unsigned long new)
33 local_irq_save(flags
);
37 local_irq_restore(flags
);
41 #define cmpxchg(ptr, o, n) \
42 ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \
46 #include <asm-generic/cmpxchg-local.h>
48 #endif /* _ASM_SCORE_CMPXCHG_H */