diff options
author | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2008-02-07 03:16:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:30 -0500 |
commit | a259b2428b10c19b94e346bc69d5b3bf9bff488e (patch) | |
tree | ceb0536890fc85e46b905239ffe44077be695b03 /include/asm-alpha/system.h | |
parent | 068fbad288a2c18b75b0425fb56d241f018a1cb5 (diff) |
Add cmpxchg64 and cmpxchg64_local to alpha
Make sure that at least cmpxchg64_local is available on all architectures to use
for unsigned long long values.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/asm-alpha/system.h')
-rw-r--r-- | include/asm-alpha/system.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/asm-alpha/system.h b/include/asm-alpha/system.h index fd9dc889f36c..ed221d6408fc 100644 --- a/include/asm-alpha/system.h +++ b/include/asm-alpha/system.h | |||
@@ -681,13 +681,18 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) | |||
681 | return old; | 681 | return old; |
682 | } | 682 | } |
683 | 683 | ||
684 | #define cmpxchg(ptr,o,n) \ | 684 | #define cmpxchg(ptr, o, n) \ |
685 | ({ \ | 685 | ({ \ |
686 | __typeof__(*(ptr)) _o_ = (o); \ | 686 | __typeof__(*(ptr)) _o_ = (o); \ |
687 | __typeof__(*(ptr)) _n_ = (n); \ | 687 | __typeof__(*(ptr)) _n_ = (n); \ |
688 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ | 688 | (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ |
689 | (unsigned long)_n_, sizeof(*(ptr))); \ | 689 | (unsigned long)_n_, sizeof(*(ptr))); \ |
690 | }) | 690 | }) |
691 | #define cmpxchg64(ptr, o, n) \ | ||
692 | ({ \ | ||
693 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
694 | cmpxchg((ptr), (o), (n)); \ | ||
695 | }) | ||
691 | 696 | ||
692 | static inline unsigned long | 697 | static inline unsigned long |
693 | __cmpxchg_u8_local(volatile char *m, long old, long new) | 698 | __cmpxchg_u8_local(volatile char *m, long old, long new) |
@@ -803,13 +808,19 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new, | |||
803 | return old; | 808 | return old; |
804 | } | 809 | } |
805 | 810 | ||
806 | #define cmpxchg_local(ptr,o,n) \ | 811 | #define cmpxchg_local(ptr, o, n) \ |
807 | ({ \ | 812 | ({ \ |
808 | __typeof__(*(ptr)) _o_ = (o); \ | 813 | __typeof__(*(ptr)) _o_ = (o); \ |
809 | __typeof__(*(ptr)) _n_ = (n); \ | 814 | __typeof__(*(ptr)) _n_ = (n); \ |
810 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ | 815 | (__typeof__(*(ptr))) __cmpxchg_local((ptr), (unsigned long)_o_, \ |
811 | (unsigned long)_n_, sizeof(*(ptr))); \ | 816 | (unsigned long)_n_, sizeof(*(ptr))); \ |
812 | }) | 817 | }) |
818 | #define cmpxchg64_local(ptr, o, n) \ | ||
819 | ({ \ | ||
820 | BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ | ||
821 | cmpxchg_local((ptr), (o), (n)); \ | ||
822 | }) | ||
823 | |||
813 | 824 | ||
814 | #endif /* __ASSEMBLY__ */ | 825 | #endif /* __ASSEMBLY__ */ |
815 | 826 | ||