aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-s390/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-s390/spinlock.h')
-rw-r--r--include/asm-s390/spinlock.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 273dbecf8ace..ce3edf6d63b3 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -11,17 +11,36 @@
11#ifndef __ASM_SPINLOCK_H 11#ifndef __ASM_SPINLOCK_H
12#define __ASM_SPINLOCK_H 12#define __ASM_SPINLOCK_H
13 13
14#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2)
15
16static inline int
17_raw_compare_and_swap(volatile unsigned int *lock,
18 unsigned int old, unsigned int new)
19{
20 asm volatile(
21 " cs %0,%3,%1"
22 : "=d" (old), "=Q" (*lock)
23 : "0" (old), "d" (new), "Q" (*lock)
24 : "cc", "memory" );
25 return old;
26}
27
28#else /* __GNUC__ */
29
14static inline int 30static inline int
15_raw_compare_and_swap(volatile unsigned int *lock, 31_raw_compare_and_swap(volatile unsigned int *lock,
16 unsigned int old, unsigned int new) 32 unsigned int old, unsigned int new)
17{ 33{
18 asm volatile ("cs %0,%3,0(%4)" 34 asm volatile(
19 : "=d" (old), "=m" (*lock) 35 " cs %0,%3,0(%4)"
20 : "0" (old), "d" (new), "a" (lock), "m" (*lock) 36 : "=d" (old), "=m" (*lock)
21 : "cc", "memory" ); 37 : "0" (old), "d" (new), "a" (lock), "m" (*lock)
38 : "cc", "memory" );
22 return old; 39 return old;
23} 40}
24 41
42#endif /* __GNUC__ */
43
25/* 44/*
26 * Simple spin lock operations. There are two variants, one clears IRQ's 45 * Simple spin lock operations. There are two variants, one clears IRQ's
27 * on the local processor, one does not. 46 * on the local processor, one does not.