1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_ATOMIC_H
3 #define __ASM_SH_ATOMIC_H
5 #if defined(CONFIG_CPU_J2)
7 #include <asm-generic/atomic.h>
12 * Atomic operations that C can't guarantee us. Useful for
13 * resource counting etc..
17 #include <linux/compiler.h>
18 #include <linux/types.h>
19 #include <asm/cmpxchg.h>
20 #include <asm/barrier.h>
22 #define arch_atomic_read(v) READ_ONCE((v)->counter)
23 #define arch_atomic_set(v,i) WRITE_ONCE((v)->counter, (i))
25 #if defined(CONFIG_GUSA_RB)
26 #include <asm/atomic-grb.h>
27 #elif defined(CONFIG_CPU_SH4A)
28 #include <asm/atomic-llsc.h>
30 #include <asm/atomic-irq.h>
33 #endif /* CONFIG_CPU_J2 */
35 #endif /* __ASM_SH_ATOMIC_H */