diff options
Diffstat (limited to 'arch/powerpc/include/asm/spinlock.h')
-rw-r--r-- | arch/powerpc/include/asm/spinlock.h | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h index 198266cf9e2d..764094cff681 100644 --- a/arch/powerpc/include/asm/spinlock.h +++ b/arch/powerpc/include/asm/spinlock.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/asm-compat.h> | 28 | #include <asm/asm-compat.h> |
29 | #include <asm/synch.h> | 29 | #include <asm/synch.h> |
30 | 30 | ||
31 | #define __raw_spin_is_locked(x) ((x)->slock != 0) | 31 | #define arch_spin_is_locked(x) ((x)->slock != 0) |
32 | 32 | ||
33 | #ifdef CONFIG_PPC64 | 33 | #ifdef CONFIG_PPC64 |
34 | /* use 0x800000yy when locked, where yy == CPU number */ | 34 | /* use 0x800000yy when locked, where yy == CPU number */ |
@@ -54,7 +54,7 @@ | |||
54 | * This returns the old value in the lock, so we succeeded | 54 | * This returns the old value in the lock, so we succeeded |
55 | * in getting the lock if the return value is 0. | 55 | * in getting the lock if the return value is 0. |
56 | */ | 56 | */ |
57 | static inline unsigned long arch_spin_trylock(raw_spinlock_t *lock) | 57 | static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock) |
58 | { | 58 | { |
59 | unsigned long tmp, token; | 59 | unsigned long tmp, token; |
60 | 60 | ||
@@ -73,10 +73,10 @@ static inline unsigned long arch_spin_trylock(raw_spinlock_t *lock) | |||
73 | return tmp; | 73 | return tmp; |
74 | } | 74 | } |
75 | 75 | ||
76 | static inline int __raw_spin_trylock(raw_spinlock_t *lock) | 76 | static inline int arch_spin_trylock(arch_spinlock_t *lock) |
77 | { | 77 | { |
78 | CLEAR_IO_SYNC; | 78 | CLEAR_IO_SYNC; |
79 | return arch_spin_trylock(lock) == 0; | 79 | return __arch_spin_trylock(lock) == 0; |
80 | } | 80 | } |
81 | 81 | ||
82 | /* | 82 | /* |
@@ -96,19 +96,19 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock) | |||
96 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) | 96 | #if defined(CONFIG_PPC_SPLPAR) || defined(CONFIG_PPC_ISERIES) |
97 | /* We only yield to the hypervisor if we are in shared processor mode */ | 97 | /* We only yield to the hypervisor if we are in shared processor mode */ |
98 | #define SHARED_PROCESSOR (get_lppaca()->shared_proc) | 98 | #define SHARED_PROCESSOR (get_lppaca()->shared_proc) |
99 | extern void __spin_yield(raw_spinlock_t *lock); | 99 | extern void __spin_yield(arch_spinlock_t *lock); |
100 | extern void __rw_yield(raw_rwlock_t *lock); | 100 | extern void __rw_yield(arch_rwlock_t *lock); |
101 | #else /* SPLPAR || ISERIES */ | 101 | #else /* SPLPAR || ISERIES */ |
102 | #define __spin_yield(x) barrier() | 102 | #define __spin_yield(x) barrier() |
103 | #define __rw_yield(x) barrier() | 103 | #define __rw_yield(x) barrier() |
104 | #define SHARED_PROCESSOR 0 | 104 | #define SHARED_PROCESSOR 0 |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | static inline void __raw_spin_lock(raw_spinlock_t *lock) | 107 | static inline void arch_spin_lock(arch_spinlock_t *lock) |
108 | { | 108 | { |
109 | CLEAR_IO_SYNC; | 109 | CLEAR_IO_SYNC; |
110 | while (1) { | 110 | while (1) { |
111 | if (likely(arch_spin_trylock(lock) == 0)) | 111 | if (likely(__arch_spin_trylock(lock) == 0)) |
112 | break; | 112 | break; |
113 | do { | 113 | do { |
114 | HMT_low(); | 114 | HMT_low(); |
@@ -120,13 +120,13 @@ static inline void __raw_spin_lock(raw_spinlock_t *lock) | |||
120 | } | 120 | } |
121 | 121 | ||
122 | static inline | 122 | static inline |
123 | void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | 123 | void arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) |
124 | { | 124 | { |
125 | unsigned long flags_dis; | 125 | unsigned long flags_dis; |
126 | 126 | ||
127 | CLEAR_IO_SYNC; | 127 | CLEAR_IO_SYNC; |
128 | while (1) { | 128 | while (1) { |
129 | if (likely(arch_spin_trylock(lock) == 0)) | 129 | if (likely(__arch_spin_trylock(lock) == 0)) |
130 | break; | 130 | break; |
131 | local_save_flags(flags_dis); | 131 | local_save_flags(flags_dis); |
132 | local_irq_restore(flags); | 132 | local_irq_restore(flags); |
@@ -140,19 +140,19 @@ void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags) | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | static inline void __raw_spin_unlock(raw_spinlock_t *lock) | 143 | static inline void arch_spin_unlock(arch_spinlock_t *lock) |
144 | { | 144 | { |
145 | SYNC_IO; | 145 | SYNC_IO; |
146 | __asm__ __volatile__("# __raw_spin_unlock\n\t" | 146 | __asm__ __volatile__("# arch_spin_unlock\n\t" |
147 | LWSYNC_ON_SMP: : :"memory"); | 147 | LWSYNC_ON_SMP: : :"memory"); |
148 | lock->slock = 0; | 148 | lock->slock = 0; |
149 | } | 149 | } |
150 | 150 | ||
151 | #ifdef CONFIG_PPC64 | 151 | #ifdef CONFIG_PPC64 |
152 | extern void __raw_spin_unlock_wait(raw_spinlock_t *lock); | 152 | extern void arch_spin_unlock_wait(arch_spinlock_t *lock); |
153 | #else | 153 | #else |
154 | #define __raw_spin_unlock_wait(lock) \ | 154 | #define arch_spin_unlock_wait(lock) \ |
155 | do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0) | 155 | do { while (arch_spin_is_locked(lock)) cpu_relax(); } while (0) |
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | /* | 158 | /* |
@@ -166,8 +166,8 @@ extern void __raw_spin_unlock_wait(raw_spinlock_t *lock); | |||
166 | * read-locks. | 166 | * read-locks. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | #define __raw_read_can_lock(rw) ((rw)->lock >= 0) | 169 | #define arch_read_can_lock(rw) ((rw)->lock >= 0) |
170 | #define __raw_write_can_lock(rw) (!(rw)->lock) | 170 | #define arch_write_can_lock(rw) (!(rw)->lock) |
171 | 171 | ||
172 | #ifdef CONFIG_PPC64 | 172 | #ifdef CONFIG_PPC64 |
173 | #define __DO_SIGN_EXTEND "extsw %0,%0\n" | 173 | #define __DO_SIGN_EXTEND "extsw %0,%0\n" |
@@ -181,7 +181,7 @@ extern void __raw_spin_unlock_wait(raw_spinlock_t *lock); | |||
181 | * This returns the old value in the lock + 1, | 181 | * This returns the old value in the lock + 1, |
182 | * so we got a read lock if the return value is > 0. | 182 | * so we got a read lock if the return value is > 0. |
183 | */ | 183 | */ |
184 | static inline long arch_read_trylock(raw_rwlock_t *rw) | 184 | static inline long __arch_read_trylock(arch_rwlock_t *rw) |
185 | { | 185 | { |
186 | long tmp; | 186 | long tmp; |
187 | 187 | ||
@@ -205,7 +205,7 @@ static inline long arch_read_trylock(raw_rwlock_t *rw) | |||
205 | * This returns the old value in the lock, | 205 | * This returns the old value in the lock, |
206 | * so we got the write lock if the return value is 0. | 206 | * so we got the write lock if the return value is 0. |
207 | */ | 207 | */ |
208 | static inline long arch_write_trylock(raw_rwlock_t *rw) | 208 | static inline long __arch_write_trylock(arch_rwlock_t *rw) |
209 | { | 209 | { |
210 | long tmp, token; | 210 | long tmp, token; |
211 | 211 | ||
@@ -225,10 +225,10 @@ static inline long arch_write_trylock(raw_rwlock_t *rw) | |||
225 | return tmp; | 225 | return tmp; |
226 | } | 226 | } |
227 | 227 | ||
228 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 228 | static inline void arch_read_lock(arch_rwlock_t *rw) |
229 | { | 229 | { |
230 | while (1) { | 230 | while (1) { |
231 | if (likely(arch_read_trylock(rw) > 0)) | 231 | if (likely(__arch_read_trylock(rw) > 0)) |
232 | break; | 232 | break; |
233 | do { | 233 | do { |
234 | HMT_low(); | 234 | HMT_low(); |
@@ -239,10 +239,10 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
239 | } | 239 | } |
240 | } | 240 | } |
241 | 241 | ||
242 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 242 | static inline void arch_write_lock(arch_rwlock_t *rw) |
243 | { | 243 | { |
244 | while (1) { | 244 | while (1) { |
245 | if (likely(arch_write_trylock(rw) == 0)) | 245 | if (likely(__arch_write_trylock(rw) == 0)) |
246 | break; | 246 | break; |
247 | do { | 247 | do { |
248 | HMT_low(); | 248 | HMT_low(); |
@@ -253,17 +253,17 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 256 | static inline int arch_read_trylock(arch_rwlock_t *rw) |
257 | { | 257 | { |
258 | return arch_read_trylock(rw) > 0; | 258 | return __arch_read_trylock(rw) > 0; |
259 | } | 259 | } |
260 | 260 | ||
261 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 261 | static inline int arch_write_trylock(arch_rwlock_t *rw) |
262 | { | 262 | { |
263 | return arch_write_trylock(rw) == 0; | 263 | return __arch_write_trylock(rw) == 0; |
264 | } | 264 | } |
265 | 265 | ||
266 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 266 | static inline void arch_read_unlock(arch_rwlock_t *rw) |
267 | { | 267 | { |
268 | long tmp; | 268 | long tmp; |
269 | 269 | ||
@@ -280,19 +280,19 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) | |||
280 | : "cr0", "xer", "memory"); | 280 | : "cr0", "xer", "memory"); |
281 | } | 281 | } |
282 | 282 | ||
283 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 283 | static inline void arch_write_unlock(arch_rwlock_t *rw) |
284 | { | 284 | { |
285 | __asm__ __volatile__("# write_unlock\n\t" | 285 | __asm__ __volatile__("# write_unlock\n\t" |
286 | LWSYNC_ON_SMP: : :"memory"); | 286 | LWSYNC_ON_SMP: : :"memory"); |
287 | rw->lock = 0; | 287 | rw->lock = 0; |
288 | } | 288 | } |
289 | 289 | ||
290 | #define __raw_read_lock_flags(lock, flags) __raw_read_lock(lock) | 290 | #define arch_read_lock_flags(lock, flags) arch_read_lock(lock) |
291 | #define __raw_write_lock_flags(lock, flags) __raw_write_lock(lock) | 291 | #define arch_write_lock_flags(lock, flags) arch_write_lock(lock) |
292 | 292 | ||
293 | #define _raw_spin_relax(lock) __spin_yield(lock) | 293 | #define arch_spin_relax(lock) __spin_yield(lock) |
294 | #define _raw_read_relax(lock) __rw_yield(lock) | 294 | #define arch_read_relax(lock) __rw_yield(lock) |
295 | #define _raw_write_relax(lock) __rw_yield(lock) | 295 | #define arch_write_relax(lock) __rw_yield(lock) |
296 | 296 | ||
297 | #endif /* __KERNEL__ */ | 297 | #endif /* __KERNEL__ */ |
298 | #endif /* __ASM_SPINLOCK_H */ | 298 | #endif /* __ASM_SPINLOCK_H */ |