diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-02-07 03:16:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:32 -0500 |
commit | 027bcc27d3d1a218dbf4477964a18fed78983357 (patch) | |
tree | a76ba273a2cdbd1866e79b3840c3293b13b50251 /include/asm-m68knommu | |
parent | 5da751035c5c8f5b30978e97fd4b3c75f453b04e (diff) |
Add cmpxchg_local to m68knommu
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: Greg Ungerer <gerg@snapgear.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-m68knommu')
-rw-r--r-- | include/asm-m68knommu/system.h | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/include/asm-m68knommu/system.h b/include/asm-m68knommu/system.h index ee2dc07bae0e..039ab3f81732 100644 --- a/include/asm-m68knommu/system.h +++ b/include/asm-m68knommu/system.h | |||
@@ -186,26 +186,20 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz | |||
186 | } | 186 | } |
187 | #endif | 187 | #endif |
188 | 188 | ||
189 | #include <asm-generic/cmpxchg-local.h> | ||
190 | |||
189 | /* | 191 | /* |
190 | * Atomic compare and exchange. Compare OLD with MEM, if identical, | 192 | * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make |
191 | * store NEW in MEM. Return the initial value in MEM. Success is | 193 | * them available. |
192 | * indicated by comparing RETURN with OLD. | ||
193 | */ | 194 | */ |
194 | #define __HAVE_ARCH_CMPXCHG 1 | 195 | #define cmpxchg_local(ptr, o, n) \ |
195 | 196 | ((__typeof__(*(ptr)))__cmpxchg_local_generic((ptr), (unsigned long)(o),\ | |
196 | static __inline__ unsigned long | 197 | (unsigned long)(n), sizeof(*(ptr)))) |
197 | cmpxchg(volatile int *p, int old, int new) | 198 | #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) |
198 | { | ||
199 | unsigned long flags; | ||
200 | int prev; | ||
201 | |||
202 | local_irq_save(flags); | ||
203 | if ((prev = *p) == old) | ||
204 | *p = new; | ||
205 | local_irq_restore(flags); | ||
206 | return(prev); | ||
207 | } | ||
208 | 199 | ||
200 | #ifndef CONFIG_SMP | ||
201 | #include <asm-generic/cmpxchg.h> | ||
202 | #endif | ||
209 | 203 | ||
210 | #if defined( CONFIG_M68328 ) || defined( CONFIG_M68EZ328 ) || \ | 204 | #if defined( CONFIG_M68328 ) || defined( CONFIG_M68EZ328 ) || \ |
211 | defined (CONFIG_M68360) || defined( CONFIG_M68VZ328 ) | 205 | defined (CONFIG_M68360) || defined( CONFIG_M68VZ328 ) |