diff options
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/include/asm/spinlock.h | 20 | ||||
-rw-r--r-- | arch/s390/lib/spinlock.c | 12 |
2 files changed, 16 insertions, 16 deletions
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h index 7f98f0e48acb..a587907d77f3 100644 --- a/arch/s390/include/asm/spinlock.h +++ b/arch/s390/include/asm/spinlock.h | |||
@@ -113,13 +113,13 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp) | |||
113 | * read_can_lock - would read_trylock() succeed? | 113 | * read_can_lock - would read_trylock() succeed? |
114 | * @lock: the rwlock in question. | 114 | * @lock: the rwlock in question. |
115 | */ | 115 | */ |
116 | #define __raw_read_can_lock(x) ((int)(x)->lock >= 0) | 116 | #define arch_read_can_lock(x) ((int)(x)->lock >= 0) |
117 | 117 | ||
118 | /** | 118 | /** |
119 | * write_can_lock - would write_trylock() succeed? | 119 | * write_can_lock - would write_trylock() succeed? |
120 | * @lock: the rwlock in question. | 120 | * @lock: the rwlock in question. |
121 | */ | 121 | */ |
122 | #define __raw_write_can_lock(x) ((x)->lock == 0) | 122 | #define arch_write_can_lock(x) ((x)->lock == 0) |
123 | 123 | ||
124 | extern void _raw_read_lock_wait(arch_rwlock_t *lp); | 124 | extern void _raw_read_lock_wait(arch_rwlock_t *lp); |
125 | extern void _raw_read_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags); | 125 | extern void _raw_read_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags); |
@@ -128,7 +128,7 @@ extern void _raw_write_lock_wait(arch_rwlock_t *lp); | |||
128 | extern void _raw_write_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags); | 128 | extern void _raw_write_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags); |
129 | extern int _raw_write_trylock_retry(arch_rwlock_t *lp); | 129 | extern int _raw_write_trylock_retry(arch_rwlock_t *lp); |
130 | 130 | ||
131 | static inline void __raw_read_lock(arch_rwlock_t *rw) | 131 | static inline void arch_read_lock(arch_rwlock_t *rw) |
132 | { | 132 | { |
133 | unsigned int old; | 133 | unsigned int old; |
134 | old = rw->lock & 0x7fffffffU; | 134 | old = rw->lock & 0x7fffffffU; |
@@ -136,7 +136,7 @@ static inline void __raw_read_lock(arch_rwlock_t *rw) | |||
136 | _raw_read_lock_wait(rw); | 136 | _raw_read_lock_wait(rw); |
137 | } | 137 | } |
138 | 138 | ||
139 | static inline void __raw_read_lock_flags(arch_rwlock_t *rw, unsigned long flags) | 139 | static inline void arch_read_lock_flags(arch_rwlock_t *rw, unsigned long flags) |
140 | { | 140 | { |
141 | unsigned int old; | 141 | unsigned int old; |
142 | old = rw->lock & 0x7fffffffU; | 142 | old = rw->lock & 0x7fffffffU; |
@@ -144,7 +144,7 @@ static inline void __raw_read_lock_flags(arch_rwlock_t *rw, unsigned long flags) | |||
144 | _raw_read_lock_wait_flags(rw, flags); | 144 | _raw_read_lock_wait_flags(rw, flags); |
145 | } | 145 | } |
146 | 146 | ||
147 | static inline void __raw_read_unlock(arch_rwlock_t *rw) | 147 | static inline void arch_read_unlock(arch_rwlock_t *rw) |
148 | { | 148 | { |
149 | unsigned int old, cmp; | 149 | unsigned int old, cmp; |
150 | 150 | ||
@@ -155,24 +155,24 @@ static inline void __raw_read_unlock(arch_rwlock_t *rw) | |||
155 | } while (cmp != old); | 155 | } while (cmp != old); |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline void __raw_write_lock(arch_rwlock_t *rw) | 158 | static inline void arch_write_lock(arch_rwlock_t *rw) |
159 | { | 159 | { |
160 | if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) | 160 | if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) |
161 | _raw_write_lock_wait(rw); | 161 | _raw_write_lock_wait(rw); |
162 | } | 162 | } |
163 | 163 | ||
164 | static inline void __raw_write_lock_flags(arch_rwlock_t *rw, unsigned long flags) | 164 | static inline void arch_write_lock_flags(arch_rwlock_t *rw, unsigned long flags) |
165 | { | 165 | { |
166 | if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) | 166 | if (unlikely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) != 0)) |
167 | _raw_write_lock_wait_flags(rw, flags); | 167 | _raw_write_lock_wait_flags(rw, flags); |
168 | } | 168 | } |
169 | 169 | ||
170 | static inline void __raw_write_unlock(arch_rwlock_t *rw) | 170 | static inline void arch_write_unlock(arch_rwlock_t *rw) |
171 | { | 171 | { |
172 | _raw_compare_and_swap(&rw->lock, 0x80000000, 0); | 172 | _raw_compare_and_swap(&rw->lock, 0x80000000, 0); |
173 | } | 173 | } |
174 | 174 | ||
175 | static inline int __raw_read_trylock(arch_rwlock_t *rw) | 175 | static inline int arch_read_trylock(arch_rwlock_t *rw) |
176 | { | 176 | { |
177 | unsigned int old; | 177 | unsigned int old; |
178 | old = rw->lock & 0x7fffffffU; | 178 | old = rw->lock & 0x7fffffffU; |
@@ -181,7 +181,7 @@ static inline int __raw_read_trylock(arch_rwlock_t *rw) | |||
181 | return _raw_read_trylock_retry(rw); | 181 | return _raw_read_trylock_retry(rw); |
182 | } | 182 | } |
183 | 183 | ||
184 | static inline int __raw_write_trylock(arch_rwlock_t *rw) | 184 | static inline int arch_write_trylock(arch_rwlock_t *rw) |
185 | { | 185 | { |
186 | if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) | 186 | if (likely(_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)) |
187 | return 1; | 187 | return 1; |
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index 09fee9a1aa15..10754a375668 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -115,7 +115,7 @@ void _raw_read_lock_wait(arch_rwlock_t *rw) | |||
115 | _raw_yield(); | 115 | _raw_yield(); |
116 | count = spin_retry; | 116 | count = spin_retry; |
117 | } | 117 | } |
118 | if (!__raw_read_can_lock(rw)) | 118 | if (!arch_read_can_lock(rw)) |
119 | continue; | 119 | continue; |
120 | old = rw->lock & 0x7fffffffU; | 120 | old = rw->lock & 0x7fffffffU; |
121 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) | 121 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) |
@@ -135,7 +135,7 @@ void _raw_read_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags) | |||
135 | _raw_yield(); | 135 | _raw_yield(); |
136 | count = spin_retry; | 136 | count = spin_retry; |
137 | } | 137 | } |
138 | if (!__raw_read_can_lock(rw)) | 138 | if (!arch_read_can_lock(rw)) |
139 | continue; | 139 | continue; |
140 | old = rw->lock & 0x7fffffffU; | 140 | old = rw->lock & 0x7fffffffU; |
141 | local_irq_disable(); | 141 | local_irq_disable(); |
@@ -151,7 +151,7 @@ int _raw_read_trylock_retry(arch_rwlock_t *rw) | |||
151 | int count = spin_retry; | 151 | int count = spin_retry; |
152 | 152 | ||
153 | while (count-- > 0) { | 153 | while (count-- > 0) { |
154 | if (!__raw_read_can_lock(rw)) | 154 | if (!arch_read_can_lock(rw)) |
155 | continue; | 155 | continue; |
156 | old = rw->lock & 0x7fffffffU; | 156 | old = rw->lock & 0x7fffffffU; |
157 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) | 157 | if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) |
@@ -170,7 +170,7 @@ void _raw_write_lock_wait(arch_rwlock_t *rw) | |||
170 | _raw_yield(); | 170 | _raw_yield(); |
171 | count = spin_retry; | 171 | count = spin_retry; |
172 | } | 172 | } |
173 | if (!__raw_write_can_lock(rw)) | 173 | if (!arch_write_can_lock(rw)) |
174 | continue; | 174 | continue; |
175 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | 175 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) |
176 | return; | 176 | return; |
@@ -188,7 +188,7 @@ void _raw_write_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags) | |||
188 | _raw_yield(); | 188 | _raw_yield(); |
189 | count = spin_retry; | 189 | count = spin_retry; |
190 | } | 190 | } |
191 | if (!__raw_write_can_lock(rw)) | 191 | if (!arch_write_can_lock(rw)) |
192 | continue; | 192 | continue; |
193 | local_irq_disable(); | 193 | local_irq_disable(); |
194 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | 194 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) |
@@ -202,7 +202,7 @@ int _raw_write_trylock_retry(arch_rwlock_t *rw) | |||
202 | int count = spin_retry; | 202 | int count = spin_retry; |
203 | 203 | ||
204 | while (count-- > 0) { | 204 | while (count-- > 0) { |
205 | if (!__raw_write_can_lock(rw)) | 205 | if (!arch_write_can_lock(rw)) |
206 | continue; | 206 | continue; |
207 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) | 207 | if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) |
208 | return 1; | 208 | return 1; |