1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_METAG_CMPXCHG_LOCK1_H
3 #define __ASM_METAG_CMPXCHG_LOCK1_H
5 #include <asm/global_lock.h>
7 /* Use LOCK2 as these have to be atomic w.r.t. ordinary accesses. */
9 static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
11 unsigned long flags, retval;
13 __global_lock2(flags);
17 __global_unlock2(flags);
21 static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
23 unsigned long flags, retval;
25 __global_lock2(flags);
29 __global_unlock2(flags);
33 static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
39 __global_lock2(flags);
45 __global_unlock2(flags);
49 #endif /* __ASM_METAG_CMPXCHG_LOCK1_H */