aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>2008-02-07 03:16:20 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:32 -0500
commit5da751035c5c8f5b30978e97fd4b3c75f453b04e (patch)
tree9d50b1187702079ba6fb5d61a84db4dbdd646937
parent7fa2ac3728ce828070fa3d5846c08157fe5ef431 (diff)
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>
-rw-r--r--include/asm-m68k/system.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/include/asm-m68k/system.h b/include/asm-m68k/system.h
index caa9b1663e45..dbb6515ffd5b 100644
--- a/include/asm-m68k/system.h
+++ b/include/asm-m68k/system.h
@@ -154,6 +154,10 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
154} 154}
155#endif 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 * Atomic compare and exchange. Compare OLD with MEM, if identical, 162 * Atomic compare and exchange. Compare OLD with MEM, if identical,
159 * store NEW in MEM. Return the initial value in MEM. Success is 163 * store NEW in MEM. Return the initial value in MEM. Success is
@@ -185,9 +189,26 @@ static inline unsigned long __cmpxchg(volatile void *p, unsigned long old,
185 return old; 189 return old;
186} 190}
187 191
188#define cmpxchg(ptr,o,n)\ 192#define cmpxchg(ptr, o, n) \
189 ((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ 193 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
190 (unsigned long)(n),sizeof(*(ptr)))) 194 (unsigned long)(n), sizeof(*(ptr))))
195#define cmpxchg_local(ptr, o, n) \
196 ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
197 (unsigned long)(n), sizeof(*(ptr))))
198#else
199
200/*
201 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
202 * them available.
203 */
204#define cmpxchg_local(ptr, o, n) \
205 ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\
206 (unsigned long)(n), sizeof(*(ptr))))
207
208#ifndef CONFIG_SMP
209#include <asm-generic/cmpxchg.h>
210#endif
211
191#endif 212#endif
192 213
193#define arch_align_stack(x) (x) 214#define arch_align_stack(x) (x)