Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Add cmpxchg_local to m86k

Use the new generic cmpxchg_local (disables interrupt). Also use the generic
cmpxchg as fallback if SMP is not set.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Mathieu Desnoyers and committed by
Linus Torvalds
5da75103 7fa2ac37

+24 -3
+24 -3
include/asm-m68k/system.h
··· 154 154 } 155 155 #endif 156 156 157 + #include <asm-generic/cmpxchg-local.h> 158 + 159 + #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) 160 + 157 161 /* 158 162 * Atomic compare and exchange. Compare OLD with MEM, if identical, 159 163 * store NEW in MEM. Return the initial value in MEM. Success is ··· 189 185 return old; 190 186 } 191 187 192 - #define cmpxchg(ptr,o,n)\ 193 - ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 194 - (unsigned long)(n),sizeof(*(ptr)))) 188 + #define cmpxchg(ptr, o, n) \ 189 + ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ 190 + (unsigned long)(n), sizeof(*(ptr)))) 191 + #define cmpxchg_local(ptr, o, n) \ 192 + ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \ 193 + (unsigned long)(n), sizeof(*(ptr)))) 194 + #else 195 + 196 + /* 197 + * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make 198 + * them available. 199 + */ 200 + #define cmpxchg_local(ptr, o, n) \ 201 + ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ 202 + (unsigned long)(n), sizeof(*(ptr)))) 203 + 204 + #ifndef CONFIG_SMP 205 + #include <asm-generic/cmpxchg.h> 206 + #endif 207 + 195 208 #endif 196 209 197 210 #define arch_align_stack(x) (x)