diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-12-03 14:01:19 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-12-14 17:55:32 -0500 |
commit | fb3a6bbc912b12347614e5742c7c61416cdb0ca0 (patch) | |
tree | f9dbf8dab23cea6f033a58672ba16abf2ae09ebd | |
parent | 0199c4e68d1f02894bdefe4b5d9e9ee4aedd8d62 (diff) |
locking: Convert raw_rwlock to arch_rwlock
Not strictly necessary for -rt as -rt does not have non sleeping
rwlocks, but it's odd to not have a consistent naming convention.
No functional change.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: linux-arch@vger.kernel.org
32 files changed, 151 insertions, 151 deletions
diff --git a/arch/alpha/include/asm/spinlock.h b/arch/alpha/include/asm/spinlock.h index 4dac79f504c3..e8b2970f037b 100644 --- a/arch/alpha/include/asm/spinlock.h +++ b/arch/alpha/include/asm/spinlock.h | |||
@@ -50,17 +50,17 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock) | |||
50 | 50 | ||
51 | /***********************************************************/ | 51 | /***********************************************************/ |
52 | 52 | ||
53 | static inline int __raw_read_can_lock(raw_rwlock_t *lock) | 53 | static inline int __raw_read_can_lock(arch_rwlock_t *lock) |
54 | { | 54 | { |
55 | return (lock->lock & 1) == 0; | 55 | return (lock->lock & 1) == 0; |
56 | } | 56 | } |
57 | 57 | ||
58 | static inline int __raw_write_can_lock(raw_rwlock_t *lock) | 58 | static inline int __raw_write_can_lock(arch_rwlock_t *lock) |
59 | { | 59 | { |
60 | return lock->lock == 0; | 60 | return lock->lock == 0; |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline void __raw_read_lock(raw_rwlock_t *lock) | 63 | static inline void __raw_read_lock(arch_rwlock_t *lock) |
64 | { | 64 | { |
65 | long regx; | 65 | long regx; |
66 | 66 | ||
@@ -80,7 +80,7 @@ static inline void __raw_read_lock(raw_rwlock_t *lock) | |||
80 | : "m" (*lock) : "memory"); | 80 | : "m" (*lock) : "memory"); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline void __raw_write_lock(raw_rwlock_t *lock) | 83 | static inline void __raw_write_lock(arch_rwlock_t *lock) |
84 | { | 84 | { |
85 | long regx; | 85 | long regx; |
86 | 86 | ||
@@ -100,7 +100,7 @@ static inline void __raw_write_lock(raw_rwlock_t *lock) | |||
100 | : "m" (*lock) : "memory"); | 100 | : "m" (*lock) : "memory"); |
101 | } | 101 | } |
102 | 102 | ||
103 | static inline int __raw_read_trylock(raw_rwlock_t * lock) | 103 | static inline int __raw_read_trylock(arch_rwlock_t * lock) |
104 | { | 104 | { |
105 | long regx; | 105 | long regx; |
106 | int success; | 106 | int success; |
@@ -122,7 +122,7 @@ static inline int __raw_read_trylock(raw_rwlock_t * lock) | |||
122 | return success; | 122 | return success; |
123 | } | 123 | } |
124 | 124 | ||
125 | static inline int __raw_write_trylock(raw_rwlock_t * lock) | 125 | static inline int __raw_write_trylock(arch_rwlock_t * lock) |
126 | { | 126 | { |
127 | long regx; | 127 | long regx; |
128 | int success; | 128 | int success; |
@@ -144,7 +144,7 @@ static inline int __raw_write_trylock(raw_rwlock_t * lock) | |||
144 | return success; | 144 | return success; |
145 | } | 145 | } |
146 | 146 | ||
147 | static inline void __raw_read_unlock(raw_rwlock_t * lock) | 147 | static inline void __raw_read_unlock(arch_rwlock_t * lock) |
148 | { | 148 | { |
149 | long regx; | 149 | long regx; |
150 | __asm__ __volatile__( | 150 | __asm__ __volatile__( |
@@ -160,7 +160,7 @@ static inline void __raw_read_unlock(raw_rwlock_t * lock) | |||
160 | : "m" (*lock) : "memory"); | 160 | : "m" (*lock) : "memory"); |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline void __raw_write_unlock(raw_rwlock_t * lock) | 163 | static inline void __raw_write_unlock(arch_rwlock_t * lock) |
164 | { | 164 | { |
165 | mb(); | 165 | mb(); |
166 | lock->lock = 0; | 166 | lock->lock = 0; |
diff --git a/arch/alpha/include/asm/spinlock_types.h b/arch/alpha/include/asm/spinlock_types.h index 08975ee0a100..54c2afce0a1d 100644 --- a/arch/alpha/include/asm/spinlock_types.h +++ b/arch/alpha/include/asm/spinlock_types.h | |||
@@ -13,8 +13,8 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h index de62eb098f68..a8671d8bc7d4 100644 --- a/arch/arm/include/asm/spinlock.h +++ b/arch/arm/include/asm/spinlock.h | |||
@@ -86,7 +86,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) | |||
86 | * just write zero since the lock is exclusively held. | 86 | * just write zero since the lock is exclusively held. |
87 | */ | 87 | */ |
88 | 88 | ||
89 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 89 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
90 | { | 90 | { |
91 | unsigned long tmp; | 91 | unsigned long tmp; |
92 | 92 | ||
@@ -106,7 +106,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
106 | smp_mb(); | 106 | smp_mb(); |
107 | } | 107 | } |
108 | 108 | ||
109 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 109 | static inline int __raw_write_trylock(arch_rwlock_t *rw) |
110 | { | 110 | { |
111 | unsigned long tmp; | 111 | unsigned long tmp; |
112 | 112 | ||
@@ -126,7 +126,7 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) | |||
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 129 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
130 | { | 130 | { |
131 | smp_mb(); | 131 | smp_mb(); |
132 | 132 | ||
@@ -156,7 +156,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
156 | * currently active. However, we know we won't have any write | 156 | * currently active. However, we know we won't have any write |
157 | * locks. | 157 | * locks. |
158 | */ | 158 | */ |
159 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 159 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
160 | { | 160 | { |
161 | unsigned long tmp, tmp2; | 161 | unsigned long tmp, tmp2; |
162 | 162 | ||
@@ -176,7 +176,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
176 | smp_mb(); | 176 | smp_mb(); |
177 | } | 177 | } |
178 | 178 | ||
179 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 179 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
180 | { | 180 | { |
181 | unsigned long tmp, tmp2; | 181 | unsigned long tmp, tmp2; |
182 | 182 | ||
@@ -198,7 +198,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) | |||
198 | : "cc"); | 198 | : "cc"); |
199 | } | 199 | } |
200 | 200 | ||
201 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 201 | static inline int __raw_read_trylock(arch_rwlock_t *rw) |
202 | { | 202 | { |
203 | unsigned long tmp, tmp2 = 1; | 203 | unsigned long tmp, tmp2 = 1; |
204 | 204 | ||
diff --git a/arch/arm/include/asm/spinlock_types.h b/arch/arm/include/asm/spinlock_types.h index 9622e126a8de..d14d197ae04a 100644 --- a/arch/arm/include/asm/spinlock_types.h +++ b/arch/arm/include/asm/spinlock_types.h | |||
@@ -13,8 +13,8 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/blackfin/include/asm/spinlock.h b/arch/blackfin/include/asm/spinlock.h index 62d49540e02b..7e1c56b0a571 100644 --- a/arch/blackfin/include/asm/spinlock.h +++ b/arch/blackfin/include/asm/spinlock.h | |||
@@ -52,42 +52,42 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) | |||
52 | cpu_relax(); | 52 | cpu_relax(); |
53 | } | 53 | } |
54 | 54 | ||
55 | static inline int __raw_read_can_lock(raw_rwlock_t *rw) | 55 | static inline int __raw_read_can_lock(arch_rwlock_t *rw) |
56 | { | 56 | { |
57 | return __raw_uncached_fetch_asm(&rw->lock) > 0; | 57 | return __raw_uncached_fetch_asm(&rw->lock) > 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | static inline int __raw_write_can_lock(raw_rwlock_t *rw) | 60 | static inline int __raw_write_can_lock(arch_rwlock_t *rw) |
61 | { | 61 | { |
62 | return __raw_uncached_fetch_asm(&rw->lock) == RW_LOCK_BIAS; | 62 | return __raw_uncached_fetch_asm(&rw->lock) == RW_LOCK_BIAS; |
63 | } | 63 | } |
64 | 64 | ||
65 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 65 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
66 | { | 66 | { |
67 | __raw_read_lock_asm(&rw->lock); | 67 | __raw_read_lock_asm(&rw->lock); |
68 | } | 68 | } |
69 | 69 | ||
70 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 70 | static inline int __raw_read_trylock(arch_rwlock_t *rw) |
71 | { | 71 | { |
72 | return __raw_read_trylock_asm(&rw->lock); | 72 | return __raw_read_trylock_asm(&rw->lock); |
73 | } | 73 | } |
74 | 74 | ||
75 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 75 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
76 | { | 76 | { |
77 | __raw_read_unlock_asm(&rw->lock); | 77 | __raw_read_unlock_asm(&rw->lock); |
78 | } | 78 | } |
79 | 79 | ||
80 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 80 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
81 | { | 81 | { |
82 | __raw_write_lock_asm(&rw->lock); | 82 | __raw_write_lock_asm(&rw->lock); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 85 | static inline int __raw_write_trylock(arch_rwlock_t *rw) |
86 | { | 86 | { |
87 | return __raw_write_trylock_asm(&rw->lock); | 87 | return __raw_write_trylock_asm(&rw->lock); |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 90 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
91 | { | 91 | { |
92 | __raw_write_unlock_asm(&rw->lock); | 92 | __raw_write_unlock_asm(&rw->lock); |
93 | } | 93 | } |
diff --git a/arch/blackfin/include/asm/spinlock_types.h b/arch/blackfin/include/asm/spinlock_types.h index c8a3928a58c5..1a33608c958b 100644 --- a/arch/blackfin/include/asm/spinlock_types.h +++ b/arch/blackfin/include/asm/spinlock_types.h | |||
@@ -21,8 +21,8 @@ typedef struct { | |||
21 | 21 | ||
22 | typedef struct { | 22 | typedef struct { |
23 | volatile unsigned int lock; | 23 | volatile unsigned int lock; |
24 | } raw_rwlock_t; | 24 | } arch_rwlock_t; |
25 | 25 | ||
26 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | 26 | #define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } |
27 | 27 | ||
28 | #endif | 28 | #endif |
diff --git a/arch/cris/include/arch-v32/arch/spinlock.h b/arch/cris/include/arch-v32/arch/spinlock.h index a2e8a394d555..1d7d3a8046cb 100644 --- a/arch/cris/include/arch-v32/arch/spinlock.h +++ b/arch/cris/include/arch-v32/arch/spinlock.h | |||
@@ -56,17 +56,17 @@ arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long flags) | |||
56 | * | 56 | * |
57 | */ | 57 | */ |
58 | 58 | ||
59 | static inline int __raw_read_can_lock(raw_rwlock_t *x) | 59 | static inline int __raw_read_can_lock(arch_rwlock_t *x) |
60 | { | 60 | { |
61 | return (int)(x)->lock > 0; | 61 | return (int)(x)->lock > 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | static inline int __raw_write_can_lock(raw_rwlock_t *x) | 64 | static inline int __raw_write_can_lock(arch_rwlock_t *x) |
65 | { | 65 | { |
66 | return (x)->lock == RW_LOCK_BIAS; | 66 | return (x)->lock == RW_LOCK_BIAS; |
67 | } | 67 | } |
68 | 68 | ||
69 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 69 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
70 | { | 70 | { |
71 | arch_spin_lock(&rw->slock); | 71 | arch_spin_lock(&rw->slock); |
72 | while (rw->lock == 0); | 72 | while (rw->lock == 0); |
@@ -74,7 +74,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
74 | arch_spin_unlock(&rw->slock); | 74 | arch_spin_unlock(&rw->slock); |
75 | } | 75 | } |
76 | 76 | ||
77 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 77 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
78 | { | 78 | { |
79 | arch_spin_lock(&rw->slock); | 79 | arch_spin_lock(&rw->slock); |
80 | while (rw->lock != RW_LOCK_BIAS); | 80 | while (rw->lock != RW_LOCK_BIAS); |
@@ -82,14 +82,14 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
82 | arch_spin_unlock(&rw->slock); | 82 | arch_spin_unlock(&rw->slock); |
83 | } | 83 | } |
84 | 84 | ||
85 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 85 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
86 | { | 86 | { |
87 | arch_spin_lock(&rw->slock); | 87 | arch_spin_lock(&rw->slock); |
88 | rw->lock++; | 88 | rw->lock++; |
89 | arch_spin_unlock(&rw->slock); | 89 | arch_spin_unlock(&rw->slock); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 92 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
93 | { | 93 | { |
94 | arch_spin_lock(&rw->slock); | 94 | arch_spin_lock(&rw->slock); |
95 | while (rw->lock != RW_LOCK_BIAS); | 95 | while (rw->lock != RW_LOCK_BIAS); |
@@ -97,7 +97,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
97 | arch_spin_unlock(&rw->slock); | 97 | arch_spin_unlock(&rw->slock); |
98 | } | 98 | } |
99 | 99 | ||
100 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 100 | static inline int __raw_read_trylock(arch_rwlock_t *rw) |
101 | { | 101 | { |
102 | int ret = 0; | 102 | int ret = 0; |
103 | arch_spin_lock(&rw->slock); | 103 | arch_spin_lock(&rw->slock); |
@@ -109,7 +109,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw) | |||
109 | return ret; | 109 | return ret; |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 112 | static inline int __raw_write_trylock(arch_rwlock_t *rw) |
113 | { | 113 | { |
114 | int ret = 0; | 114 | int ret = 0; |
115 | arch_spin_lock(&rw->slock); | 115 | arch_spin_lock(&rw->slock); |
diff --git a/arch/ia64/include/asm/spinlock.h b/arch/ia64/include/asm/spinlock.h index b06165f6352f..6715b6a8ebc3 100644 --- a/arch/ia64/include/asm/spinlock.h +++ b/arch/ia64/include/asm/spinlock.h | |||
@@ -146,7 +146,7 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) | |||
146 | #ifdef ASM_SUPPORTED | 146 | #ifdef ASM_SUPPORTED |
147 | 147 | ||
148 | static __always_inline void | 148 | static __always_inline void |
149 | __raw_read_lock_flags(raw_rwlock_t *lock, unsigned long flags) | 149 | __raw_read_lock_flags(arch_rwlock_t *lock, unsigned long flags) |
150 | { | 150 | { |
151 | __asm__ __volatile__ ( | 151 | __asm__ __volatile__ ( |
152 | "tbit.nz p6, p0 = %1,%2\n" | 152 | "tbit.nz p6, p0 = %1,%2\n" |
@@ -177,7 +177,7 @@ __raw_read_lock_flags(raw_rwlock_t *lock, unsigned long flags) | |||
177 | 177 | ||
178 | #define __raw_read_lock(rw) \ | 178 | #define __raw_read_lock(rw) \ |
179 | do { \ | 179 | do { \ |
180 | raw_rwlock_t *__read_lock_ptr = (rw); \ | 180 | arch_rwlock_t *__read_lock_ptr = (rw); \ |
181 | \ | 181 | \ |
182 | while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ | 182 | while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) { \ |
183 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ | 183 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ |
@@ -190,14 +190,14 @@ do { \ | |||
190 | 190 | ||
191 | #define __raw_read_unlock(rw) \ | 191 | #define __raw_read_unlock(rw) \ |
192 | do { \ | 192 | do { \ |
193 | raw_rwlock_t *__read_lock_ptr = (rw); \ | 193 | arch_rwlock_t *__read_lock_ptr = (rw); \ |
194 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ | 194 | ia64_fetchadd(-1, (int *) __read_lock_ptr, rel); \ |
195 | } while (0) | 195 | } while (0) |
196 | 196 | ||
197 | #ifdef ASM_SUPPORTED | 197 | #ifdef ASM_SUPPORTED |
198 | 198 | ||
199 | static __always_inline void | 199 | static __always_inline void |
200 | __raw_write_lock_flags(raw_rwlock_t *lock, unsigned long flags) | 200 | __raw_write_lock_flags(arch_rwlock_t *lock, unsigned long flags) |
201 | { | 201 | { |
202 | __asm__ __volatile__ ( | 202 | __asm__ __volatile__ ( |
203 | "tbit.nz p6, p0 = %1, %2\n" | 203 | "tbit.nz p6, p0 = %1, %2\n" |
@@ -235,7 +235,7 @@ __raw_write_lock_flags(raw_rwlock_t *lock, unsigned long flags) | |||
235 | (result == 0); \ | 235 | (result == 0); \ |
236 | }) | 236 | }) |
237 | 237 | ||
238 | static inline void __raw_write_unlock(raw_rwlock_t *x) | 238 | static inline void __raw_write_unlock(arch_rwlock_t *x) |
239 | { | 239 | { |
240 | u8 *y = (u8 *)x; | 240 | u8 *y = (u8 *)x; |
241 | barrier(); | 241 | barrier(); |
@@ -265,7 +265,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *x) | |||
265 | (ia64_val == 0); \ | 265 | (ia64_val == 0); \ |
266 | }) | 266 | }) |
267 | 267 | ||
268 | static inline void __raw_write_unlock(raw_rwlock_t *x) | 268 | static inline void __raw_write_unlock(arch_rwlock_t *x) |
269 | { | 269 | { |
270 | barrier(); | 270 | barrier(); |
271 | x->write_lock = 0; | 271 | x->write_lock = 0; |
@@ -273,10 +273,10 @@ static inline void __raw_write_unlock(raw_rwlock_t *x) | |||
273 | 273 | ||
274 | #endif /* !ASM_SUPPORTED */ | 274 | #endif /* !ASM_SUPPORTED */ |
275 | 275 | ||
276 | static inline int __raw_read_trylock(raw_rwlock_t *x) | 276 | static inline int __raw_read_trylock(arch_rwlock_t *x) |
277 | { | 277 | { |
278 | union { | 278 | union { |
279 | raw_rwlock_t lock; | 279 | arch_rwlock_t lock; |
280 | __u32 word; | 280 | __u32 word; |
281 | } old, new; | 281 | } old, new; |
282 | old.lock = new.lock = *x; | 282 | old.lock = new.lock = *x; |
diff --git a/arch/ia64/include/asm/spinlock_types.h b/arch/ia64/include/asm/spinlock_types.h index 6a11b65fa66d..e2b42a52a6d3 100644 --- a/arch/ia64/include/asm/spinlock_types.h +++ b/arch/ia64/include/asm/spinlock_types.h | |||
@@ -14,8 +14,8 @@ typedef struct { | |||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int read_counter : 31; | 15 | volatile unsigned int read_counter : 31; |
16 | volatile unsigned int write_lock : 1; | 16 | volatile unsigned int write_lock : 1; |
17 | } raw_rwlock_t; | 17 | } arch_rwlock_t; |
18 | 18 | ||
19 | #define __RAW_RW_LOCK_UNLOCKED { 0, 0 } | 19 | #define __ARCH_RW_LOCK_UNLOCKED { 0, 0 } |
20 | 20 | ||
21 | #endif | 21 | #endif |
diff --git a/arch/m32r/include/asm/spinlock.h b/arch/m32r/include/asm/spinlock.h index 8acac950a43c..1c76af8c8e1b 100644 --- a/arch/m32r/include/asm/spinlock.h +++ b/arch/m32r/include/asm/spinlock.h | |||
@@ -148,7 +148,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) | |||
148 | */ | 148 | */ |
149 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 149 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) |
150 | 150 | ||
151 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 151 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
152 | { | 152 | { |
153 | unsigned long tmp0, tmp1; | 153 | unsigned long tmp0, tmp1; |
154 | 154 | ||
@@ -199,7 +199,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
199 | ); | 199 | ); |
200 | } | 200 | } |
201 | 201 | ||
202 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 202 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
203 | { | 203 | { |
204 | unsigned long tmp0, tmp1, tmp2; | 204 | unsigned long tmp0, tmp1, tmp2; |
205 | 205 | ||
@@ -252,7 +252,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
252 | ); | 252 | ); |
253 | } | 253 | } |
254 | 254 | ||
255 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 255 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
256 | { | 256 | { |
257 | unsigned long tmp0, tmp1; | 257 | unsigned long tmp0, tmp1; |
258 | 258 | ||
@@ -274,7 +274,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) | |||
274 | ); | 274 | ); |
275 | } | 275 | } |
276 | 276 | ||
277 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 277 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
278 | { | 278 | { |
279 | unsigned long tmp0, tmp1, tmp2; | 279 | unsigned long tmp0, tmp1, tmp2; |
280 | 280 | ||
@@ -298,7 +298,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
298 | ); | 298 | ); |
299 | } | 299 | } |
300 | 300 | ||
301 | static inline int __raw_read_trylock(raw_rwlock_t *lock) | 301 | static inline int __raw_read_trylock(arch_rwlock_t *lock) |
302 | { | 302 | { |
303 | atomic_t *count = (atomic_t*)lock; | 303 | atomic_t *count = (atomic_t*)lock; |
304 | if (atomic_dec_return(count) >= 0) | 304 | if (atomic_dec_return(count) >= 0) |
@@ -307,7 +307,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *lock) | |||
307 | return 0; | 307 | return 0; |
308 | } | 308 | } |
309 | 309 | ||
310 | static inline int __raw_write_trylock(raw_rwlock_t *lock) | 310 | static inline int __raw_write_trylock(arch_rwlock_t *lock) |
311 | { | 311 | { |
312 | atomic_t *count = (atomic_t *)lock; | 312 | atomic_t *count = (atomic_t *)lock; |
313 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) | 313 | if (atomic_sub_and_test(RW_LOCK_BIAS, count)) |
diff --git a/arch/m32r/include/asm/spinlock_types.h b/arch/m32r/include/asm/spinlock_types.h index 5873a8701107..92e27672661f 100644 --- a/arch/m32r/include/asm/spinlock_types.h +++ b/arch/m32r/include/asm/spinlock_types.h | |||
@@ -13,11 +13,11 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile int lock; | 15 | volatile int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define RW_LOCK_BIAS 0x01000000 | 18 | #define RW_LOCK_BIAS 0x01000000 |
19 | #define RW_LOCK_BIAS_STR "0x01000000" | 19 | #define RW_LOCK_BIAS_STR "0x01000000" |
20 | 20 | ||
21 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | 21 | #define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } |
22 | 22 | ||
23 | #endif /* _ASM_M32R_SPINLOCK_TYPES_H */ | 23 | #endif /* _ASM_M32R_SPINLOCK_TYPES_H */ |
diff --git a/arch/mips/include/asm/spinlock.h b/arch/mips/include/asm/spinlock.h index 95edebaaf22a..7bf27c8a3364 100644 --- a/arch/mips/include/asm/spinlock.h +++ b/arch/mips/include/asm/spinlock.h | |||
@@ -256,7 +256,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock) | |||
256 | */ | 256 | */ |
257 | #define __raw_write_can_lock(rw) (!(rw)->lock) | 257 | #define __raw_write_can_lock(rw) (!(rw)->lock) |
258 | 258 | ||
259 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 259 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
260 | { | 260 | { |
261 | unsigned int tmp; | 261 | unsigned int tmp; |
262 | 262 | ||
@@ -301,7 +301,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
301 | /* Note the use of sub, not subu which will make the kernel die with an | 301 | /* Note the use of sub, not subu which will make the kernel die with an |
302 | overflow exception if we ever try to unlock an rwlock that is already | 302 | overflow exception if we ever try to unlock an rwlock that is already |
303 | unlocked or is being held by a writer. */ | 303 | unlocked or is being held by a writer. */ |
304 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 304 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
305 | { | 305 | { |
306 | unsigned int tmp; | 306 | unsigned int tmp; |
307 | 307 | ||
@@ -335,7 +335,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) | |||
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
338 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 338 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
339 | { | 339 | { |
340 | unsigned int tmp; | 340 | unsigned int tmp; |
341 | 341 | ||
@@ -377,7 +377,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
377 | smp_llsc_mb(); | 377 | smp_llsc_mb(); |
378 | } | 378 | } |
379 | 379 | ||
380 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 380 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
381 | { | 381 | { |
382 | smp_mb(); | 382 | smp_mb(); |
383 | 383 | ||
@@ -389,7 +389,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
389 | : "memory"); | 389 | : "memory"); |
390 | } | 390 | } |
391 | 391 | ||
392 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 392 | static inline int __raw_read_trylock(arch_rwlock_t *rw) |
393 | { | 393 | { |
394 | unsigned int tmp; | 394 | unsigned int tmp; |
395 | int ret; | 395 | int ret; |
@@ -433,7 +433,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw) | |||
433 | return ret; | 433 | return ret; |
434 | } | 434 | } |
435 | 435 | ||
436 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 436 | static inline int __raw_write_trylock(arch_rwlock_t *rw) |
437 | { | 437 | { |
438 | unsigned int tmp; | 438 | unsigned int tmp; |
439 | int ret; | 439 | int ret; |
diff --git a/arch/mips/include/asm/spinlock_types.h b/arch/mips/include/asm/spinlock_types.h index b4c5efaadb9c..ee197c2f9c98 100644 --- a/arch/mips/include/asm/spinlock_types.h +++ b/arch/mips/include/asm/spinlock_types.h | |||
@@ -18,8 +18,8 @@ typedef struct { | |||
18 | 18 | ||
19 | typedef struct { | 19 | typedef struct { |
20 | volatile unsigned int lock; | 20 | volatile unsigned int lock; |
21 | } raw_rwlock_t; | 21 | } arch_rwlock_t; |
22 | 22 | ||
23 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 23 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
24 | 24 | ||
25 | #endif | 25 | #endif |
diff --git a/arch/parisc/include/asm/spinlock.h b/arch/parisc/include/asm/spinlock.h index 235e7e386e2a..1ff3a0a94a43 100644 --- a/arch/parisc/include/asm/spinlock.h +++ b/arch/parisc/include/asm/spinlock.h | |||
@@ -69,7 +69,7 @@ static inline int arch_spin_trylock(arch_spinlock_t *x) | |||
69 | 69 | ||
70 | /* Note that we have to ensure interrupts are disabled in case we're | 70 | /* Note that we have to ensure interrupts are disabled in case we're |
71 | * interrupted by some other code that wants to grab the same read lock */ | 71 | * interrupted by some other code that wants to grab the same read lock */ |
72 | static __inline__ void __raw_read_lock(raw_rwlock_t *rw) | 72 | static __inline__ void __raw_read_lock(arch_rwlock_t *rw) |
73 | { | 73 | { |
74 | unsigned long flags; | 74 | unsigned long flags; |
75 | local_irq_save(flags); | 75 | local_irq_save(flags); |
@@ -81,7 +81,7 @@ static __inline__ void __raw_read_lock(raw_rwlock_t *rw) | |||
81 | 81 | ||
82 | /* Note that we have to ensure interrupts are disabled in case we're | 82 | /* Note that we have to ensure interrupts are disabled in case we're |
83 | * interrupted by some other code that wants to grab the same read lock */ | 83 | * interrupted by some other code that wants to grab the same read lock */ |
84 | static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) | 84 | static __inline__ void __raw_read_unlock(arch_rwlock_t *rw) |
85 | { | 85 | { |
86 | unsigned long flags; | 86 | unsigned long flags; |
87 | local_irq_save(flags); | 87 | local_irq_save(flags); |
@@ -93,7 +93,7 @@ static __inline__ void __raw_read_unlock(raw_rwlock_t *rw) | |||
93 | 93 | ||
94 | /* Note that we have to ensure interrupts are disabled in case we're | 94 | /* Note that we have to ensure interrupts are disabled in case we're |
95 | * interrupted by some other code that wants to grab the same read lock */ | 95 | * interrupted by some other code that wants to grab the same read lock */ |
96 | static __inline__ int __raw_read_trylock(raw_rwlock_t *rw) | 96 | static __inline__ int __raw_read_trylock(arch_rwlock_t *rw) |
97 | { | 97 | { |
98 | unsigned long flags; | 98 | unsigned long flags; |
99 | retry: | 99 | retry: |
@@ -119,7 +119,7 @@ static __inline__ int __raw_read_trylock(raw_rwlock_t *rw) | |||
119 | 119 | ||
120 | /* Note that we have to ensure interrupts are disabled in case we're | 120 | /* Note that we have to ensure interrupts are disabled in case we're |
121 | * interrupted by some other code that wants to read_trylock() this lock */ | 121 | * interrupted by some other code that wants to read_trylock() this lock */ |
122 | static __inline__ void __raw_write_lock(raw_rwlock_t *rw) | 122 | static __inline__ void __raw_write_lock(arch_rwlock_t *rw) |
123 | { | 123 | { |
124 | unsigned long flags; | 124 | unsigned long flags; |
125 | retry: | 125 | retry: |
@@ -141,7 +141,7 @@ retry: | |||
141 | local_irq_restore(flags); | 141 | local_irq_restore(flags); |
142 | } | 142 | } |
143 | 143 | ||
144 | static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) | 144 | static __inline__ void __raw_write_unlock(arch_rwlock_t *rw) |
145 | { | 145 | { |
146 | rw->counter = 0; | 146 | rw->counter = 0; |
147 | arch_spin_unlock(&rw->lock); | 147 | arch_spin_unlock(&rw->lock); |
@@ -149,7 +149,7 @@ static __inline__ void __raw_write_unlock(raw_rwlock_t *rw) | |||
149 | 149 | ||
150 | /* Note that we have to ensure interrupts are disabled in case we're | 150 | /* Note that we have to ensure interrupts are disabled in case we're |
151 | * interrupted by some other code that wants to read_trylock() this lock */ | 151 | * interrupted by some other code that wants to read_trylock() this lock */ |
152 | static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) | 152 | static __inline__ int __raw_write_trylock(arch_rwlock_t *rw) |
153 | { | 153 | { |
154 | unsigned long flags; | 154 | unsigned long flags; |
155 | int result = 0; | 155 | int result = 0; |
@@ -173,7 +173,7 @@ static __inline__ int __raw_write_trylock(raw_rwlock_t *rw) | |||
173 | * read_can_lock - would read_trylock() succeed? | 173 | * read_can_lock - would read_trylock() succeed? |
174 | * @lock: the rwlock in question. | 174 | * @lock: the rwlock in question. |
175 | */ | 175 | */ |
176 | static __inline__ int __raw_read_can_lock(raw_rwlock_t *rw) | 176 | static __inline__ int __raw_read_can_lock(arch_rwlock_t *rw) |
177 | { | 177 | { |
178 | return rw->counter >= 0; | 178 | return rw->counter >= 0; |
179 | } | 179 | } |
@@ -182,7 +182,7 @@ static __inline__ int __raw_read_can_lock(raw_rwlock_t *rw) | |||
182 | * write_can_lock - would write_trylock() succeed? | 182 | * write_can_lock - would write_trylock() succeed? |
183 | * @lock: the rwlock in question. | 183 | * @lock: the rwlock in question. |
184 | */ | 184 | */ |
185 | static __inline__ int __raw_write_can_lock(raw_rwlock_t *rw) | 185 | static __inline__ int __raw_write_can_lock(arch_rwlock_t *rw) |
186 | { | 186 | { |
187 | return !rw->counter; | 187 | return !rw->counter; |
188 | } | 188 | } |
diff --git a/arch/parisc/include/asm/spinlock_types.h b/arch/parisc/include/asm/spinlock_types.h index 396d2746ca57..8c373aa28a86 100644 --- a/arch/parisc/include/asm/spinlock_types.h +++ b/arch/parisc/include/asm/spinlock_types.h | |||
@@ -14,8 +14,8 @@ typedef struct { | |||
14 | typedef struct { | 14 | typedef struct { |
15 | arch_spinlock_t lock; | 15 | arch_spinlock_t lock; |
16 | volatile int counter; | 16 | volatile int counter; |
17 | } raw_rwlock_t; | 17 | } arch_rwlock_t; |
18 | 18 | ||
19 | #define __RAW_RW_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED, 0 } | 19 | #define __ARCH_RW_LOCK_UNLOCKED { __ARCH_SPIN_LOCK_UNLOCKED, 0 } |
20 | 20 | ||
21 | #endif | 21 | #endif |
diff --git a/arch/powerpc/include/asm/spinlock.h b/arch/powerpc/include/asm/spinlock.h index cdcaf6b97087..2fad2c07c593 100644 --- a/arch/powerpc/include/asm/spinlock.h +++ b/arch/powerpc/include/asm/spinlock.h | |||
@@ -97,7 +97,7 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock) | |||
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(arch_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() |
@@ -181,7 +181,7 @@ extern void arch_spin_unlock_wait(arch_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,7 +225,7 @@ 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 __raw_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)) |
@@ -239,7 +239,7 @@ 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 __raw_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)) |
@@ -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 __raw_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 __raw_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 __raw_read_unlock(arch_rwlock_t *rw) |
267 | { | 267 | { |
268 | long tmp; | 268 | long tmp; |
269 | 269 | ||
@@ -280,7 +280,7 @@ 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 __raw_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"); |
diff --git a/arch/powerpc/include/asm/spinlock_types.h b/arch/powerpc/include/asm/spinlock_types.h index f5f39d82711f..2351adc4fdc4 100644 --- a/arch/powerpc/include/asm/spinlock_types.h +++ b/arch/powerpc/include/asm/spinlock_types.h | |||
@@ -13,8 +13,8 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile signed int lock; | 15 | volatile signed int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c index ee395e392115..58e14fba11b1 100644 --- a/arch/powerpc/lib/locks.c +++ b/arch/powerpc/lib/locks.c | |||
@@ -55,7 +55,7 @@ void __spin_yield(arch_spinlock_t *lock) | |||
55 | * This turns out to be the same for read and write locks, since | 55 | * This turns out to be the same for read and write locks, since |
56 | * we only know the holder if it is write-locked. | 56 | * we only know the holder if it is write-locked. |
57 | */ | 57 | */ |
58 | void __rw_yield(raw_rwlock_t *rw) | 58 | void __rw_yield(arch_rwlock_t *rw) |
59 | { | 59 | { |
60 | int lock_value; | 60 | int lock_value; |
61 | unsigned int holder_cpu, yield_count; | 61 | unsigned int holder_cpu, yield_count; |
diff --git a/arch/s390/include/asm/spinlock.h b/arch/s390/include/asm/spinlock.h index a94c146657a9..7f98f0e48acb 100644 --- a/arch/s390/include/asm/spinlock.h +++ b/arch/s390/include/asm/spinlock.h | |||
@@ -121,14 +121,14 @@ static inline void arch_spin_unlock(arch_spinlock_t *lp) | |||
121 | */ | 121 | */ |
122 | #define __raw_write_can_lock(x) ((x)->lock == 0) | 122 | #define __raw_write_can_lock(x) ((x)->lock == 0) |
123 | 123 | ||
124 | extern void _raw_read_lock_wait(raw_rwlock_t *lp); | 124 | extern void _raw_read_lock_wait(arch_rwlock_t *lp); |
125 | extern void _raw_read_lock_wait_flags(raw_rwlock_t *lp, unsigned long flags); | 125 | extern void _raw_read_lock_wait_flags(arch_rwlock_t *lp, unsigned long flags); |
126 | extern int _raw_read_trylock_retry(raw_rwlock_t *lp); | 126 | extern int _raw_read_trylock_retry(arch_rwlock_t *lp); |
127 | extern void _raw_write_lock_wait(raw_rwlock_t *lp); | 127 | extern void _raw_write_lock_wait(arch_rwlock_t *lp); |
128 | extern void _raw_write_lock_wait_flags(raw_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(raw_rwlock_t *lp); | 129 | extern int _raw_write_trylock_retry(arch_rwlock_t *lp); |
130 | 130 | ||
131 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 131 | static inline void __raw_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(raw_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(raw_rwlock_t *rw, unsigned long flags) | 139 | static inline void __raw_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(raw_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(raw_rwlock_t *rw) | 147 | static inline void __raw_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(raw_rwlock_t *rw) | |||
155 | } while (cmp != old); | 155 | } while (cmp != old); |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 158 | static inline void __raw_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(raw_rwlock_t *rw, unsigned long flags) | 164 | static inline void __raw_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(raw_rwlock_t *rw) | 170 | static inline void __raw_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(raw_rwlock_t *rw) | 175 | static inline int __raw_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(raw_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(raw_rwlock_t *rw) | 184 | static inline int __raw_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/include/asm/spinlock_types.h b/arch/s390/include/asm/spinlock_types.h index e25c0370f6cd..9c76656a0af0 100644 --- a/arch/s390/include/asm/spinlock_types.h +++ b/arch/s390/include/asm/spinlock_types.h | |||
@@ -13,8 +13,8 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c index f4596452f072..09fee9a1aa15 100644 --- a/arch/s390/lib/spinlock.c +++ b/arch/s390/lib/spinlock.c | |||
@@ -105,7 +105,7 @@ void arch_spin_relax(arch_spinlock_t *lock) | |||
105 | } | 105 | } |
106 | EXPORT_SYMBOL(arch_spin_relax); | 106 | EXPORT_SYMBOL(arch_spin_relax); |
107 | 107 | ||
108 | void _raw_read_lock_wait(raw_rwlock_t *rw) | 108 | void _raw_read_lock_wait(arch_rwlock_t *rw) |
109 | { | 109 | { |
110 | unsigned int old; | 110 | unsigned int old; |
111 | int count = spin_retry; | 111 | int count = spin_retry; |
@@ -124,7 +124,7 @@ void _raw_read_lock_wait(raw_rwlock_t *rw) | |||
124 | } | 124 | } |
125 | EXPORT_SYMBOL(_raw_read_lock_wait); | 125 | EXPORT_SYMBOL(_raw_read_lock_wait); |
126 | 126 | ||
127 | void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | 127 | void _raw_read_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags) |
128 | { | 128 | { |
129 | unsigned int old; | 129 | unsigned int old; |
130 | int count = spin_retry; | 130 | int count = spin_retry; |
@@ -145,7 +145,7 @@ void _raw_read_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | |||
145 | } | 145 | } |
146 | EXPORT_SYMBOL(_raw_read_lock_wait_flags); | 146 | EXPORT_SYMBOL(_raw_read_lock_wait_flags); |
147 | 147 | ||
148 | int _raw_read_trylock_retry(raw_rwlock_t *rw) | 148 | int _raw_read_trylock_retry(arch_rwlock_t *rw) |
149 | { | 149 | { |
150 | unsigned int old; | 150 | unsigned int old; |
151 | int count = spin_retry; | 151 | int count = spin_retry; |
@@ -161,7 +161,7 @@ int _raw_read_trylock_retry(raw_rwlock_t *rw) | |||
161 | } | 161 | } |
162 | EXPORT_SYMBOL(_raw_read_trylock_retry); | 162 | EXPORT_SYMBOL(_raw_read_trylock_retry); |
163 | 163 | ||
164 | void _raw_write_lock_wait(raw_rwlock_t *rw) | 164 | void _raw_write_lock_wait(arch_rwlock_t *rw) |
165 | { | 165 | { |
166 | int count = spin_retry; | 166 | int count = spin_retry; |
167 | 167 | ||
@@ -178,7 +178,7 @@ void _raw_write_lock_wait(raw_rwlock_t *rw) | |||
178 | } | 178 | } |
179 | EXPORT_SYMBOL(_raw_write_lock_wait); | 179 | EXPORT_SYMBOL(_raw_write_lock_wait); |
180 | 180 | ||
181 | void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | 181 | void _raw_write_lock_wait_flags(arch_rwlock_t *rw, unsigned long flags) |
182 | { | 182 | { |
183 | int count = spin_retry; | 183 | int count = spin_retry; |
184 | 184 | ||
@@ -197,7 +197,7 @@ void _raw_write_lock_wait_flags(raw_rwlock_t *rw, unsigned long flags) | |||
197 | } | 197 | } |
198 | EXPORT_SYMBOL(_raw_write_lock_wait_flags); | 198 | EXPORT_SYMBOL(_raw_write_lock_wait_flags); |
199 | 199 | ||
200 | int _raw_write_trylock_retry(raw_rwlock_t *rw) | 200 | int _raw_write_trylock_retry(arch_rwlock_t *rw) |
201 | { | 201 | { |
202 | int count = spin_retry; | 202 | int count = spin_retry; |
203 | 203 | ||
diff --git a/arch/sh/include/asm/spinlock.h b/arch/sh/include/asm/spinlock.h index da1c6491ed4b..7f3626aac869 100644 --- a/arch/sh/include/asm/spinlock.h +++ b/arch/sh/include/asm/spinlock.h | |||
@@ -108,7 +108,7 @@ static inline int arch_spin_trylock(arch_spinlock_t *lock) | |||
108 | */ | 108 | */ |
109 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) | 109 | #define __raw_write_can_lock(x) ((x)->lock == RW_LOCK_BIAS) |
110 | 110 | ||
111 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 111 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
112 | { | 112 | { |
113 | unsigned long tmp; | 113 | unsigned long tmp; |
114 | 114 | ||
@@ -126,7 +126,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
126 | ); | 126 | ); |
127 | } | 127 | } |
128 | 128 | ||
129 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 129 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
130 | { | 130 | { |
131 | unsigned long tmp; | 131 | unsigned long tmp; |
132 | 132 | ||
@@ -142,7 +142,7 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw) | |||
142 | ); | 142 | ); |
143 | } | 143 | } |
144 | 144 | ||
145 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 145 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
146 | { | 146 | { |
147 | unsigned long tmp; | 147 | unsigned long tmp; |
148 | 148 | ||
@@ -160,7 +160,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
160 | ); | 160 | ); |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 163 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
164 | { | 164 | { |
165 | __asm__ __volatile__ ( | 165 | __asm__ __volatile__ ( |
166 | "mov.l %1, @%0 ! __raw_write_unlock \n\t" | 166 | "mov.l %1, @%0 ! __raw_write_unlock \n\t" |
@@ -170,7 +170,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
170 | ); | 170 | ); |
171 | } | 171 | } |
172 | 172 | ||
173 | static inline int __raw_read_trylock(raw_rwlock_t *rw) | 173 | static inline int __raw_read_trylock(arch_rwlock_t *rw) |
174 | { | 174 | { |
175 | unsigned long tmp, oldval; | 175 | unsigned long tmp, oldval; |
176 | 176 | ||
@@ -193,7 +193,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw) | |||
193 | return (oldval > 0); | 193 | return (oldval > 0); |
194 | } | 194 | } |
195 | 195 | ||
196 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 196 | static inline int __raw_write_trylock(arch_rwlock_t *rw) |
197 | { | 197 | { |
198 | unsigned long tmp, oldval; | 198 | unsigned long tmp, oldval; |
199 | 199 | ||
diff --git a/arch/sh/include/asm/spinlock_types.h b/arch/sh/include/asm/spinlock_types.h index a3be2db960ed..9b7560db06ca 100644 --- a/arch/sh/include/asm/spinlock_types.h +++ b/arch/sh/include/asm/spinlock_types.h | |||
@@ -13,9 +13,9 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define RW_LOCK_BIAS 0x01000000 | 18 | #define RW_LOCK_BIAS 0x01000000 |
19 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | 19 | #define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } |
20 | 20 | ||
21 | #endif | 21 | #endif |
diff --git a/arch/sparc/include/asm/spinlock_32.h b/arch/sparc/include/asm/spinlock_32.h index 9b0f2f53c81c..06d37e588fde 100644 --- a/arch/sparc/include/asm/spinlock_32.h +++ b/arch/sparc/include/asm/spinlock_32.h | |||
@@ -65,7 +65,7 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) | |||
65 | * Sort of like atomic_t's on Sparc, but even more clever. | 65 | * Sort of like atomic_t's on Sparc, but even more clever. |
66 | * | 66 | * |
67 | * ------------------------------------ | 67 | * ------------------------------------ |
68 | * | 24-bit counter | wlock | raw_rwlock_t | 68 | * | 24-bit counter | wlock | arch_rwlock_t |
69 | * ------------------------------------ | 69 | * ------------------------------------ |
70 | * 31 8 7 0 | 70 | * 31 8 7 0 |
71 | * | 71 | * |
@@ -76,9 +76,9 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock) | |||
76 | * | 76 | * |
77 | * Unfortunately this scheme limits us to ~16,000,000 cpus. | 77 | * Unfortunately this scheme limits us to ~16,000,000 cpus. |
78 | */ | 78 | */ |
79 | static inline void arch_read_lock(raw_rwlock_t *rw) | 79 | static inline void arch_read_lock(arch_rwlock_t *rw) |
80 | { | 80 | { |
81 | register raw_rwlock_t *lp asm("g1"); | 81 | register arch_rwlock_t *lp asm("g1"); |
82 | lp = rw; | 82 | lp = rw; |
83 | __asm__ __volatile__( | 83 | __asm__ __volatile__( |
84 | "mov %%o7, %%g4\n\t" | 84 | "mov %%o7, %%g4\n\t" |
@@ -96,9 +96,9 @@ do { unsigned long flags; \ | |||
96 | local_irq_restore(flags); \ | 96 | local_irq_restore(flags); \ |
97 | } while(0) | 97 | } while(0) |
98 | 98 | ||
99 | static inline void arch_read_unlock(raw_rwlock_t *rw) | 99 | static inline void arch_read_unlock(arch_rwlock_t *rw) |
100 | { | 100 | { |
101 | register raw_rwlock_t *lp asm("g1"); | 101 | register arch_rwlock_t *lp asm("g1"); |
102 | lp = rw; | 102 | lp = rw; |
103 | __asm__ __volatile__( | 103 | __asm__ __volatile__( |
104 | "mov %%o7, %%g4\n\t" | 104 | "mov %%o7, %%g4\n\t" |
@@ -116,9 +116,9 @@ do { unsigned long flags; \ | |||
116 | local_irq_restore(flags); \ | 116 | local_irq_restore(flags); \ |
117 | } while(0) | 117 | } while(0) |
118 | 118 | ||
119 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 119 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
120 | { | 120 | { |
121 | register raw_rwlock_t *lp asm("g1"); | 121 | register arch_rwlock_t *lp asm("g1"); |
122 | lp = rw; | 122 | lp = rw; |
123 | __asm__ __volatile__( | 123 | __asm__ __volatile__( |
124 | "mov %%o7, %%g4\n\t" | 124 | "mov %%o7, %%g4\n\t" |
@@ -130,7 +130,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
130 | *(volatile __u32 *)&lp->lock = ~0U; | 130 | *(volatile __u32 *)&lp->lock = ~0U; |
131 | } | 131 | } |
132 | 132 | ||
133 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 133 | static inline int __raw_write_trylock(arch_rwlock_t *rw) |
134 | { | 134 | { |
135 | unsigned int val; | 135 | unsigned int val; |
136 | 136 | ||
@@ -150,9 +150,9 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) | |||
150 | return (val == 0); | 150 | return (val == 0); |
151 | } | 151 | } |
152 | 152 | ||
153 | static inline int arch_read_trylock(raw_rwlock_t *rw) | 153 | static inline int arch_read_trylock(arch_rwlock_t *rw) |
154 | { | 154 | { |
155 | register raw_rwlock_t *lp asm("g1"); | 155 | register arch_rwlock_t *lp asm("g1"); |
156 | register int res asm("o0"); | 156 | register int res asm("o0"); |
157 | lp = rw; | 157 | lp = rw; |
158 | __asm__ __volatile__( | 158 | __asm__ __volatile__( |
diff --git a/arch/sparc/include/asm/spinlock_64.h b/arch/sparc/include/asm/spinlock_64.h index 7cf58a2fcda4..2b22d7f2c2fb 100644 --- a/arch/sparc/include/asm/spinlock_64.h +++ b/arch/sparc/include/asm/spinlock_64.h | |||
@@ -92,7 +92,7 @@ static inline void arch_spin_lock_flags(arch_spinlock_t *lock, unsigned long fla | |||
92 | 92 | ||
93 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ | 93 | /* Multi-reader locks, these are much saner than the 32-bit Sparc ones... */ |
94 | 94 | ||
95 | static void inline arch_read_lock(raw_rwlock_t *lock) | 95 | static void inline arch_read_lock(arch_rwlock_t *lock) |
96 | { | 96 | { |
97 | unsigned long tmp1, tmp2; | 97 | unsigned long tmp1, tmp2; |
98 | 98 | ||
@@ -115,7 +115,7 @@ static void inline arch_read_lock(raw_rwlock_t *lock) | |||
115 | : "memory"); | 115 | : "memory"); |
116 | } | 116 | } |
117 | 117 | ||
118 | static int inline arch_read_trylock(raw_rwlock_t *lock) | 118 | static int inline arch_read_trylock(arch_rwlock_t *lock) |
119 | { | 119 | { |
120 | int tmp1, tmp2; | 120 | int tmp1, tmp2; |
121 | 121 | ||
@@ -136,7 +136,7 @@ static int inline arch_read_trylock(raw_rwlock_t *lock) | |||
136 | return tmp1; | 136 | return tmp1; |
137 | } | 137 | } |
138 | 138 | ||
139 | static void inline arch_read_unlock(raw_rwlock_t *lock) | 139 | static void inline arch_read_unlock(arch_rwlock_t *lock) |
140 | { | 140 | { |
141 | unsigned long tmp1, tmp2; | 141 | unsigned long tmp1, tmp2; |
142 | 142 | ||
@@ -152,7 +152,7 @@ static void inline arch_read_unlock(raw_rwlock_t *lock) | |||
152 | : "memory"); | 152 | : "memory"); |
153 | } | 153 | } |
154 | 154 | ||
155 | static void inline arch_write_lock(raw_rwlock_t *lock) | 155 | static void inline arch_write_lock(arch_rwlock_t *lock) |
156 | { | 156 | { |
157 | unsigned long mask, tmp1, tmp2; | 157 | unsigned long mask, tmp1, tmp2; |
158 | 158 | ||
@@ -177,7 +177,7 @@ static void inline arch_write_lock(raw_rwlock_t *lock) | |||
177 | : "memory"); | 177 | : "memory"); |
178 | } | 178 | } |
179 | 179 | ||
180 | static void inline arch_write_unlock(raw_rwlock_t *lock) | 180 | static void inline arch_write_unlock(arch_rwlock_t *lock) |
181 | { | 181 | { |
182 | __asm__ __volatile__( | 182 | __asm__ __volatile__( |
183 | " stw %%g0, [%0]" | 183 | " stw %%g0, [%0]" |
@@ -186,7 +186,7 @@ static void inline arch_write_unlock(raw_rwlock_t *lock) | |||
186 | : "memory"); | 186 | : "memory"); |
187 | } | 187 | } |
188 | 188 | ||
189 | static int inline arch_write_trylock(raw_rwlock_t *lock) | 189 | static int inline arch_write_trylock(arch_rwlock_t *lock) |
190 | { | 190 | { |
191 | unsigned long mask, tmp1, tmp2, result; | 191 | unsigned long mask, tmp1, tmp2, result; |
192 | 192 | ||
diff --git a/arch/sparc/include/asm/spinlock_types.h b/arch/sparc/include/asm/spinlock_types.h index c145e63a5d66..9c454fdeaad8 100644 --- a/arch/sparc/include/asm/spinlock_types.h +++ b/arch/sparc/include/asm/spinlock_types.h | |||
@@ -13,8 +13,8 @@ typedef struct { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | volatile unsigned int lock; | 15 | volatile unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { 0 } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { 0 } |
19 | 19 | ||
20 | #endif | 20 | #endif |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index ab9055fd57d9..99cb86e843a0 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
@@ -232,7 +232,7 @@ static inline void arch_spin_unlock_wait(arch_spinlock_t *lock) | |||
232 | * read_can_lock - would read_trylock() succeed? | 232 | * read_can_lock - would read_trylock() succeed? |
233 | * @lock: the rwlock in question. | 233 | * @lock: the rwlock in question. |
234 | */ | 234 | */ |
235 | static inline int __raw_read_can_lock(raw_rwlock_t *lock) | 235 | static inline int __raw_read_can_lock(arch_rwlock_t *lock) |
236 | { | 236 | { |
237 | return (int)(lock)->lock > 0; | 237 | return (int)(lock)->lock > 0; |
238 | } | 238 | } |
@@ -241,12 +241,12 @@ static inline int __raw_read_can_lock(raw_rwlock_t *lock) | |||
241 | * write_can_lock - would write_trylock() succeed? | 241 | * write_can_lock - would write_trylock() succeed? |
242 | * @lock: the rwlock in question. | 242 | * @lock: the rwlock in question. |
243 | */ | 243 | */ |
244 | static inline int __raw_write_can_lock(raw_rwlock_t *lock) | 244 | static inline int __raw_write_can_lock(arch_rwlock_t *lock) |
245 | { | 245 | { |
246 | return (lock)->lock == RW_LOCK_BIAS; | 246 | return (lock)->lock == RW_LOCK_BIAS; |
247 | } | 247 | } |
248 | 248 | ||
249 | static inline void __raw_read_lock(raw_rwlock_t *rw) | 249 | static inline void __raw_read_lock(arch_rwlock_t *rw) |
250 | { | 250 | { |
251 | asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" | 251 | asm volatile(LOCK_PREFIX " subl $1,(%0)\n\t" |
252 | "jns 1f\n" | 252 | "jns 1f\n" |
@@ -255,7 +255,7 @@ static inline void __raw_read_lock(raw_rwlock_t *rw) | |||
255 | ::LOCK_PTR_REG (rw) : "memory"); | 255 | ::LOCK_PTR_REG (rw) : "memory"); |
256 | } | 256 | } |
257 | 257 | ||
258 | static inline void __raw_write_lock(raw_rwlock_t *rw) | 258 | static inline void __raw_write_lock(arch_rwlock_t *rw) |
259 | { | 259 | { |
260 | asm volatile(LOCK_PREFIX " subl %1,(%0)\n\t" | 260 | asm volatile(LOCK_PREFIX " subl %1,(%0)\n\t" |
261 | "jz 1f\n" | 261 | "jz 1f\n" |
@@ -264,7 +264,7 @@ static inline void __raw_write_lock(raw_rwlock_t *rw) | |||
264 | ::LOCK_PTR_REG (rw), "i" (RW_LOCK_BIAS) : "memory"); | 264 | ::LOCK_PTR_REG (rw), "i" (RW_LOCK_BIAS) : "memory"); |
265 | } | 265 | } |
266 | 266 | ||
267 | static inline int __raw_read_trylock(raw_rwlock_t *lock) | 267 | static inline int __raw_read_trylock(arch_rwlock_t *lock) |
268 | { | 268 | { |
269 | atomic_t *count = (atomic_t *)lock; | 269 | atomic_t *count = (atomic_t *)lock; |
270 | 270 | ||
@@ -274,7 +274,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *lock) | |||
274 | return 0; | 274 | return 0; |
275 | } | 275 | } |
276 | 276 | ||
277 | static inline int __raw_write_trylock(raw_rwlock_t *lock) | 277 | static inline int __raw_write_trylock(arch_rwlock_t *lock) |
278 | { | 278 | { |
279 | atomic_t *count = (atomic_t *)lock; | 279 | atomic_t *count = (atomic_t *)lock; |
280 | 280 | ||
@@ -284,12 +284,12 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock) | |||
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
286 | 286 | ||
287 | static inline void __raw_read_unlock(raw_rwlock_t *rw) | 287 | static inline void __raw_read_unlock(arch_rwlock_t *rw) |
288 | { | 288 | { |
289 | asm volatile(LOCK_PREFIX "incl %0" :"+m" (rw->lock) : : "memory"); | 289 | asm volatile(LOCK_PREFIX "incl %0" :"+m" (rw->lock) : : "memory"); |
290 | } | 290 | } |
291 | 291 | ||
292 | static inline void __raw_write_unlock(raw_rwlock_t *rw) | 292 | static inline void __raw_write_unlock(arch_rwlock_t *rw) |
293 | { | 293 | { |
294 | asm volatile(LOCK_PREFIX "addl %1, %0" | 294 | asm volatile(LOCK_PREFIX "addl %1, %0" |
295 | : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory"); | 295 | : "+m" (rw->lock) : "i" (RW_LOCK_BIAS) : "memory"); |
diff --git a/arch/x86/include/asm/spinlock_types.h b/arch/x86/include/asm/spinlock_types.h index 696f8364a4f3..dcb48b2edc11 100644 --- a/arch/x86/include/asm/spinlock_types.h +++ b/arch/x86/include/asm/spinlock_types.h | |||
@@ -13,8 +13,8 @@ typedef struct arch_spinlock { | |||
13 | 13 | ||
14 | typedef struct { | 14 | typedef struct { |
15 | unsigned int lock; | 15 | unsigned int lock; |
16 | } raw_rwlock_t; | 16 | } arch_rwlock_t; |
17 | 17 | ||
18 | #define __RAW_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } | 18 | #define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } |
19 | 19 | ||
20 | #endif /* _ASM_X86_SPINLOCK_TYPES_H */ | 20 | #endif /* _ASM_X86_SPINLOCK_TYPES_H */ |
diff --git a/include/linux/rwlock_types.h b/include/linux/rwlock_types.h index f8c935206a41..bd31808c7d8e 100644 --- a/include/linux/rwlock_types.h +++ b/include/linux/rwlock_types.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * Released under the General Public License (GPL). | 9 | * Released under the General Public License (GPL). |
10 | */ | 10 | */ |
11 | typedef struct { | 11 | typedef struct { |
12 | raw_rwlock_t raw_lock; | 12 | arch_rwlock_t raw_lock; |
13 | #ifdef CONFIG_GENERIC_LOCKBREAK | 13 | #ifdef CONFIG_GENERIC_LOCKBREAK |
14 | unsigned int break_lock; | 14 | unsigned int break_lock; |
15 | #endif | 15 | #endif |
@@ -32,14 +32,14 @@ typedef struct { | |||
32 | 32 | ||
33 | #ifdef CONFIG_DEBUG_SPINLOCK | 33 | #ifdef CONFIG_DEBUG_SPINLOCK |
34 | #define __RW_LOCK_UNLOCKED(lockname) \ | 34 | #define __RW_LOCK_UNLOCKED(lockname) \ |
35 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | 35 | (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ |
36 | .magic = RWLOCK_MAGIC, \ | 36 | .magic = RWLOCK_MAGIC, \ |
37 | .owner = SPINLOCK_OWNER_INIT, \ | 37 | .owner = SPINLOCK_OWNER_INIT, \ |
38 | .owner_cpu = -1, \ | 38 | .owner_cpu = -1, \ |
39 | RW_DEP_MAP_INIT(lockname) } | 39 | RW_DEP_MAP_INIT(lockname) } |
40 | #else | 40 | #else |
41 | #define __RW_LOCK_UNLOCKED(lockname) \ | 41 | #define __RW_LOCK_UNLOCKED(lockname) \ |
42 | (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ | 42 | (rwlock_t) { .raw_lock = __ARCH_RW_LOCK_UNLOCKED, \ |
43 | RW_DEP_MAP_INIT(lockname) } | 43 | RW_DEP_MAP_INIT(lockname) } |
44 | #endif | 44 | #endif |
45 | 45 | ||
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index de3a022489c6..53bc2213b414 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -8,7 +8,7 @@ | |||
8 | * | 8 | * |
9 | * on SMP builds: | 9 | * on SMP builds: |
10 | * | 10 | * |
11 | * asm/spinlock_types.h: contains the arch_spinlock_t/raw_rwlock_t and the | 11 | * asm/spinlock_types.h: contains the arch_spinlock_t/arch_rwlock_t and the |
12 | * initializers | 12 | * initializers |
13 | * | 13 | * |
14 | * linux/spinlock_types.h: | 14 | * linux/spinlock_types.h: |
@@ -75,7 +75,7 @@ | |||
75 | #define __lockfunc __attribute__((section(".spinlock.text"))) | 75 | #define __lockfunc __attribute__((section(".spinlock.text"))) |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * Pull the arch_spinlock_t and raw_rwlock_t definitions: | 78 | * Pull the arch_spinlock_t and arch_rwlock_t definitions: |
79 | */ | 79 | */ |
80 | #include <linux/spinlock_types.h> | 80 | #include <linux/spinlock_types.h> |
81 | 81 | ||
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h index 10db021f4875..c09b6407ae1b 100644 --- a/include/linux/spinlock_types_up.h +++ b/include/linux/spinlock_types_up.h | |||
@@ -30,8 +30,8 @@ typedef struct { } arch_spinlock_t; | |||
30 | 30 | ||
31 | typedef struct { | 31 | typedef struct { |
32 | /* no debug version on UP */ | 32 | /* no debug version on UP */ |
33 | } raw_rwlock_t; | 33 | } arch_rwlock_t; |
34 | 34 | ||
35 | #define __RAW_RW_LOCK_UNLOCKED { } | 35 | #define __ARCH_RW_LOCK_UNLOCKED { } |
36 | 36 | ||
37 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ | 37 | #endif /* __LINUX_SPINLOCK_TYPES_UP_H */ |
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index 1304fe094546..3f72f10d9cb0 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
@@ -41,7 +41,7 @@ void __rwlock_init(rwlock_t *lock, const char *name, | |||
41 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); | 41 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); |
42 | lockdep_init_map(&lock->dep_map, name, key, 0); | 42 | lockdep_init_map(&lock->dep_map, name, key, 0); |
43 | #endif | 43 | #endif |
44 | lock->raw_lock = (raw_rwlock_t) __RAW_RW_LOCK_UNLOCKED; | 44 | lock->raw_lock = (arch_rwlock_t) __ARCH_RW_LOCK_UNLOCKED; |
45 | lock->magic = RWLOCK_MAGIC; | 45 | lock->magic = RWLOCK_MAGIC; |
46 | lock->owner = SPINLOCK_OWNER_INIT; | 46 | lock->owner = SPINLOCK_OWNER_INIT; |
47 | lock->owner_cpu = -1; | 47 | lock->owner_cpu = -1; |