/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_SH_ATOMIC_H #define __ASM_SH_ATOMIC_H #if defined(CONFIG_CPU_J2) #include #else /* * Atomic operations that C can't guarantee us. Useful for * resource counting etc.. * */ #include #include #include #include #define arch_atomic_read(v) READ_ONCE((v)->counter) #define arch_atomic_set(v,i) WRITE_ONCE((v)->counter, (i)) #if defined(CONFIG_GUSA_RB) #include #elif defined(CONFIG_CPU_SH4A) #include #else #include #endif #define arch_atomic_xchg(v, new) (arch_xchg(&((v)->counter), new)) #define arch_atomic_cmpxchg(v, o, n) (arch_cmpxchg(&((v)->counter), (o), (n))) #endif /* CONFIG_CPU_J2 */ #endif /* __ASM_SH_ATOMIC_H */