aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/lib/spinlock.c12
-rw-r--r--include/asm-s390/spinlock.h19
-rw-r--r--include/asm-s390/spinlock_types.h1
3 files changed, 10 insertions, 22 deletions
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 8d76403fcf89..59c56c3d72d0 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -39,7 +39,7 @@ static inline void _raw_yield_cpu(int cpu)
39 _raw_yield(); 39 _raw_yield();
40} 40}
41 41
42void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc) 42void _raw_spin_lock_wait(raw_spinlock_t *lp)
43{ 43{
44 int count = spin_retry; 44 int count = spin_retry;
45 unsigned int cpu = ~smp_processor_id(); 45 unsigned int cpu = ~smp_processor_id();
@@ -53,15 +53,13 @@ void _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc)
53 } 53 }
54 if (__raw_spin_is_locked(lp)) 54 if (__raw_spin_is_locked(lp))
55 continue; 55 continue;
56 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) { 56 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
57 lp->owner_pc = pc;
58 return; 57 return;
59 }
60 } 58 }
61} 59}
62EXPORT_SYMBOL(_raw_spin_lock_wait); 60EXPORT_SYMBOL(_raw_spin_lock_wait);
63 61
64int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc) 62int _raw_spin_trylock_retry(raw_spinlock_t *lp)
65{ 63{
66 unsigned int cpu = ~smp_processor_id(); 64 unsigned int cpu = ~smp_processor_id();
67 int count; 65 int count;
@@ -69,10 +67,8 @@ int _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
69 for (count = spin_retry; count > 0; count--) { 67 for (count = spin_retry; count > 0; count--) {
70 if (__raw_spin_is_locked(lp)) 68 if (__raw_spin_is_locked(lp))
71 continue; 69 continue;
72 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0) { 70 if (_raw_compare_and_swap(&lp->owner_cpu, 0, cpu) == 0)
73 lp->owner_pc = pc;
74 return 1; 71 return 1;
75 }
76 } 72 }
77 return 0; 73 return 0;
78} 74}
diff --git a/include/asm-s390/spinlock.h b/include/asm-s390/spinlock.h
index 3fd43826fd0b..c1d6e7e304e2 100644
--- a/include/asm-s390/spinlock.h
+++ b/include/asm-s390/spinlock.h
@@ -58,39 +58,32 @@ _raw_compare_and_swap(volatile unsigned int *lock,
58 do { while (__raw_spin_is_locked(lock)) \ 58 do { while (__raw_spin_is_locked(lock)) \
59 _raw_spin_relax(lock); } while (0) 59 _raw_spin_relax(lock); } while (0)
60 60
61extern void _raw_spin_lock_wait(raw_spinlock_t *, unsigned int pc); 61extern void _raw_spin_lock_wait(raw_spinlock_t *);
62extern int _raw_spin_trylock_retry(raw_spinlock_t *, unsigned int pc); 62extern int _raw_spin_trylock_retry(raw_spinlock_t *);
63extern void _raw_spin_relax(raw_spinlock_t *lock); 63extern void _raw_spin_relax(raw_spinlock_t *lock);
64 64
65static inline void __raw_spin_lock(raw_spinlock_t *lp) 65static inline void __raw_spin_lock(raw_spinlock_t *lp)
66{ 66{
67 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
68 int old; 67 int old;
69 68
70 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id()); 69 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
71 if (likely(old == 0)) { 70 if (likely(old == 0))
72 lp->owner_pc = pc;
73 return; 71 return;
74 } 72 _raw_spin_lock_wait(lp);
75 _raw_spin_lock_wait(lp, pc);
76} 73}
77 74
78static inline int __raw_spin_trylock(raw_spinlock_t *lp) 75static inline int __raw_spin_trylock(raw_spinlock_t *lp)
79{ 76{
80 unsigned long pc = 1 | (unsigned long) __builtin_return_address(0);
81 int old; 77 int old;
82 78
83 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id()); 79 old = _raw_compare_and_swap(&lp->owner_cpu, 0, ~smp_processor_id());
84 if (likely(old == 0)) { 80 if (likely(old == 0))
85 lp->owner_pc = pc;
86 return 1; 81 return 1;
87 } 82 return _raw_spin_trylock_retry(lp);
88 return _raw_spin_trylock_retry(lp, pc);
89} 83}
90 84
91static inline void __raw_spin_unlock(raw_spinlock_t *lp) 85static inline void __raw_spin_unlock(raw_spinlock_t *lp)
92{ 86{
93 lp->owner_pc = 0;
94 _raw_compare_and_swap(&lp->owner_cpu, lp->owner_cpu, 0); 87 _raw_compare_and_swap(&lp->owner_cpu, lp->owner_cpu, 0);
95} 88}
96 89
diff --git a/include/asm-s390/spinlock_types.h b/include/asm-s390/spinlock_types.h
index b7ac13f7aa37..654abc40de04 100644
--- a/include/asm-s390/spinlock_types.h
+++ b/include/asm-s390/spinlock_types.h
@@ -7,7 +7,6 @@
7 7
8typedef struct { 8typedef struct {
9 volatile unsigned int owner_cpu; 9 volatile unsigned int owner_cpu;
10 volatile unsigned int owner_pc;
11} __attribute__ ((aligned (4))) raw_spinlock_t; 10} __attribute__ ((aligned (4))) raw_spinlock_t;
12 11
13#define __RAW_SPIN_LOCK_UNLOCKED { 0 } 12#define __RAW_SPIN_LOCK_UNLOCKED { 0 }