aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sparc64')
-rw-r--r--include/asm-sparc64/system.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/asm-sparc64/system.h b/include/asm-sparc64/system.h
index 99a669c190c7..1faefa6d3708 100644
--- a/include/asm-sparc64/system.h
+++ b/include/asm-sparc64/system.h
@@ -8,6 +8,7 @@
8#ifndef __ASSEMBLY__ 8#ifndef __ASSEMBLY__
9 9
10#include <linux/irqflags.h> 10#include <linux/irqflags.h>
11#include <asm-generic/cmpxchg-local.h>
11 12
12/* 13/*
13 * Sparc (general) CPU types 14 * Sparc (general) CPU types
@@ -315,6 +316,34 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size)
315 (unsigned long)_n_, sizeof(*(ptr))); \ 316 (unsigned long)_n_, sizeof(*(ptr))); \
316 }) 317 })
317 318
319/*
320 * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make
321 * them available.
322 */
323
324static inline unsigned long __cmpxchg_local(volatile void *ptr,
325 unsigned long old,
326 unsigned long new, int size)
327{
328 switch (size) {
329 case 4:
330 case 8: return __cmpxchg(ptr, old, new, size);
331 default:
332 return __cmpxchg_local_generic(ptr, old, new, size);
333 }
334
335 return old;
336}
337
338#define cmpxchg_local(ptr, o, n) \
339 ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
340 (unsigned long)(n), sizeof(*(ptr))))
341#define cmpxchg64_local(ptr, o, n) \
342 ({ \
343 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
344 cmpxchg_local((ptr), (o), (n)); \
345 })
346
318#endif /* !(__ASSEMBLY__) */ 347#endif /* !(__ASSEMBLY__) */
319 348
320#define arch_align_stack(x) (x) 349#define arch_align_stack(x) (x)