diff options
Diffstat (limited to 'lib/spinlock_debug.c')
-rw-r--r-- | lib/spinlock_debug.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index 9c4b0256490b..4755b98b6dfb 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
@@ -13,8 +13,8 @@ | |||
13 | #include <linux/delay.h> | 13 | #include <linux/delay.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | 15 | ||
16 | void __spin_lock_init(spinlock_t *lock, const char *name, | 16 | void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name, |
17 | struct lock_class_key *key) | 17 | struct lock_class_key *key) |
18 | { | 18 | { |
19 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 19 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
20 | /* | 20 | /* |
@@ -23,13 +23,13 @@ void __spin_lock_init(spinlock_t *lock, const char *name, | |||
23 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); | 23 | debug_check_no_locks_freed((void *)lock, sizeof(*lock)); |
24 | lockdep_init_map(&lock->dep_map, name, key, 0); | 24 | lockdep_init_map(&lock->dep_map, name, key, 0); |
25 | #endif | 25 | #endif |
26 | lock->raw_lock = (raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED; | 26 | lock->raw_lock = (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED; |
27 | lock->magic = SPINLOCK_MAGIC; | 27 | lock->magic = SPINLOCK_MAGIC; |
28 | lock->owner = SPINLOCK_OWNER_INIT; | 28 | lock->owner = SPINLOCK_OWNER_INIT; |
29 | lock->owner_cpu = -1; | 29 | lock->owner_cpu = -1; |
30 | } | 30 | } |
31 | 31 | ||
32 | EXPORT_SYMBOL(__spin_lock_init); | 32 | EXPORT_SYMBOL(__raw_spin_lock_init); |
33 | 33 | ||
34 | void __rwlock_init(rwlock_t *lock, const char *name, | 34 | void __rwlock_init(rwlock_t *lock, const char *name, |
35 | struct lock_class_key *key) | 35 | struct lock_class_key *key) |
@@ -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; |
@@ -49,7 +49,7 @@ void __rwlock_init(rwlock_t *lock, const char *name, | |||
49 | 49 | ||
50 | EXPORT_SYMBOL(__rwlock_init); | 50 | EXPORT_SYMBOL(__rwlock_init); |
51 | 51 | ||
52 | static void spin_bug(spinlock_t *lock, const char *msg) | 52 | static void spin_bug(raw_spinlock_t *lock, const char *msg) |
53 | { | 53 | { |
54 | struct task_struct *owner = NULL; | 54 | struct task_struct *owner = NULL; |
55 | 55 | ||
@@ -73,7 +73,7 @@ static void spin_bug(spinlock_t *lock, const char *msg) | |||
73 | #define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg) | 73 | #define SPIN_BUG_ON(cond, lock, msg) if (unlikely(cond)) spin_bug(lock, msg) |
74 | 74 | ||
75 | static inline void | 75 | static inline void |
76 | debug_spin_lock_before(spinlock_t *lock) | 76 | debug_spin_lock_before(raw_spinlock_t *lock) |
77 | { | 77 | { |
78 | SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); | 78 | SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); |
79 | SPIN_BUG_ON(lock->owner == current, lock, "recursion"); | 79 | SPIN_BUG_ON(lock->owner == current, lock, "recursion"); |
@@ -81,16 +81,16 @@ debug_spin_lock_before(spinlock_t *lock) | |||
81 | lock, "cpu recursion"); | 81 | lock, "cpu recursion"); |
82 | } | 82 | } |
83 | 83 | ||
84 | static inline void debug_spin_lock_after(spinlock_t *lock) | 84 | static inline void debug_spin_lock_after(raw_spinlock_t *lock) |
85 | { | 85 | { |
86 | lock->owner_cpu = raw_smp_processor_id(); | 86 | lock->owner_cpu = raw_smp_processor_id(); |
87 | lock->owner = current; | 87 | lock->owner = current; |
88 | } | 88 | } |
89 | 89 | ||
90 | static inline void debug_spin_unlock(spinlock_t *lock) | 90 | static inline void debug_spin_unlock(raw_spinlock_t *lock) |
91 | { | 91 | { |
92 | SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); | 92 | SPIN_BUG_ON(lock->magic != SPINLOCK_MAGIC, lock, "bad magic"); |
93 | SPIN_BUG_ON(!spin_is_locked(lock), lock, "already unlocked"); | 93 | SPIN_BUG_ON(!raw_spin_is_locked(lock), lock, "already unlocked"); |
94 | SPIN_BUG_ON(lock->owner != current, lock, "wrong owner"); | 94 | SPIN_BUG_ON(lock->owner != current, lock, "wrong owner"); |
95 | SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), | 95 | SPIN_BUG_ON(lock->owner_cpu != raw_smp_processor_id(), |
96 | lock, "wrong CPU"); | 96 | lock, "wrong CPU"); |
@@ -98,7 +98,7 @@ static inline void debug_spin_unlock(spinlock_t *lock) | |||
98 | lock->owner_cpu = -1; | 98 | lock->owner_cpu = -1; |
99 | } | 99 | } |
100 | 100 | ||
101 | static void __spin_lock_debug(spinlock_t *lock) | 101 | static void __spin_lock_debug(raw_spinlock_t *lock) |
102 | { | 102 | { |
103 | u64 i; | 103 | u64 i; |
104 | u64 loops = loops_per_jiffy * HZ; | 104 | u64 loops = loops_per_jiffy * HZ; |
@@ -106,7 +106,7 @@ static void __spin_lock_debug(spinlock_t *lock) | |||
106 | 106 | ||
107 | for (;;) { | 107 | for (;;) { |
108 | for (i = 0; i < loops; i++) { | 108 | for (i = 0; i < loops; i++) { |
109 | if (__raw_spin_trylock(&lock->raw_lock)) | 109 | if (arch_spin_trylock(&lock->raw_lock)) |
110 | return; | 110 | return; |
111 | __delay(1); | 111 | __delay(1); |
112 | } | 112 | } |
@@ -125,17 +125,17 @@ static void __spin_lock_debug(spinlock_t *lock) | |||
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||
128 | void _raw_spin_lock(spinlock_t *lock) | 128 | void do_raw_spin_lock(raw_spinlock_t *lock) |
129 | { | 129 | { |
130 | debug_spin_lock_before(lock); | 130 | debug_spin_lock_before(lock); |
131 | if (unlikely(!__raw_spin_trylock(&lock->raw_lock))) | 131 | if (unlikely(!arch_spin_trylock(&lock->raw_lock))) |
132 | __spin_lock_debug(lock); | 132 | __spin_lock_debug(lock); |
133 | debug_spin_lock_after(lock); | 133 | debug_spin_lock_after(lock); |
134 | } | 134 | } |
135 | 135 | ||
136 | int _raw_spin_trylock(spinlock_t *lock) | 136 | int do_raw_spin_trylock(raw_spinlock_t *lock) |
137 | { | 137 | { |
138 | int ret = __raw_spin_trylock(&lock->raw_lock); | 138 | int ret = arch_spin_trylock(&lock->raw_lock); |
139 | 139 | ||
140 | if (ret) | 140 | if (ret) |
141 | debug_spin_lock_after(lock); | 141 | debug_spin_lock_after(lock); |
@@ -148,10 +148,10 @@ int _raw_spin_trylock(spinlock_t *lock) | |||
148 | return ret; | 148 | return ret; |
149 | } | 149 | } |
150 | 150 | ||
151 | void _raw_spin_unlock(spinlock_t *lock) | 151 | void do_raw_spin_unlock(raw_spinlock_t *lock) |
152 | { | 152 | { |
153 | debug_spin_unlock(lock); | 153 | debug_spin_unlock(lock); |
154 | __raw_spin_unlock(&lock->raw_lock); | 154 | arch_spin_unlock(&lock->raw_lock); |
155 | } | 155 | } |
156 | 156 | ||
157 | static void rwlock_bug(rwlock_t *lock, const char *msg) | 157 | static void rwlock_bug(rwlock_t *lock, const char *msg) |
@@ -176,7 +176,7 @@ static void __read_lock_debug(rwlock_t *lock) | |||
176 | 176 | ||
177 | for (;;) { | 177 | for (;;) { |
178 | for (i = 0; i < loops; i++) { | 178 | for (i = 0; i < loops; i++) { |
179 | if (__raw_read_trylock(&lock->raw_lock)) | 179 | if (arch_read_trylock(&lock->raw_lock)) |
180 | return; | 180 | return; |
181 | __delay(1); | 181 | __delay(1); |
182 | } | 182 | } |
@@ -193,15 +193,15 @@ static void __read_lock_debug(rwlock_t *lock) | |||
193 | } | 193 | } |
194 | #endif | 194 | #endif |
195 | 195 | ||
196 | void _raw_read_lock(rwlock_t *lock) | 196 | void do_raw_read_lock(rwlock_t *lock) |
197 | { | 197 | { |
198 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | 198 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); |
199 | __raw_read_lock(&lock->raw_lock); | 199 | arch_read_lock(&lock->raw_lock); |
200 | } | 200 | } |
201 | 201 | ||
202 | int _raw_read_trylock(rwlock_t *lock) | 202 | int do_raw_read_trylock(rwlock_t *lock) |
203 | { | 203 | { |
204 | int ret = __raw_read_trylock(&lock->raw_lock); | 204 | int ret = arch_read_trylock(&lock->raw_lock); |
205 | 205 | ||
206 | #ifndef CONFIG_SMP | 206 | #ifndef CONFIG_SMP |
207 | /* | 207 | /* |
@@ -212,10 +212,10 @@ int _raw_read_trylock(rwlock_t *lock) | |||
212 | return ret; | 212 | return ret; |
213 | } | 213 | } |
214 | 214 | ||
215 | void _raw_read_unlock(rwlock_t *lock) | 215 | void do_raw_read_unlock(rwlock_t *lock) |
216 | { | 216 | { |
217 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); | 217 | RWLOCK_BUG_ON(lock->magic != RWLOCK_MAGIC, lock, "bad magic"); |
218 | __raw_read_unlock(&lock->raw_lock); | 218 | arch_read_unlock(&lock->raw_lock); |
219 | } | 219 | } |
220 | 220 | ||
221 | static inline void debug_write_lock_before(rwlock_t *lock) | 221 | static inline void debug_write_lock_before(rwlock_t *lock) |
@@ -251,7 +251,7 @@ static void __write_lock_debug(rwlock_t *lock) | |||
251 | 251 | ||
252 | for (;;) { | 252 | for (;;) { |
253 | for (i = 0; i < loops; i++) { | 253 | for (i = 0; i < loops; i++) { |
254 | if (__raw_write_trylock(&lock->raw_lock)) | 254 | if (arch_write_trylock(&lock->raw_lock)) |
255 | return; | 255 | return; |
256 | __delay(1); | 256 | __delay(1); |
257 | } | 257 | } |
@@ -268,16 +268,16 @@ static void __write_lock_debug(rwlock_t *lock) | |||
268 | } | 268 | } |
269 | #endif | 269 | #endif |
270 | 270 | ||
271 | void _raw_write_lock(rwlock_t *lock) | 271 | void do_raw_write_lock(rwlock_t *lock) |
272 | { | 272 | { |
273 | debug_write_lock_before(lock); | 273 | debug_write_lock_before(lock); |
274 | __raw_write_lock(&lock->raw_lock); | 274 | arch_write_lock(&lock->raw_lock); |
275 | debug_write_lock_after(lock); | 275 | debug_write_lock_after(lock); |
276 | } | 276 | } |
277 | 277 | ||
278 | int _raw_write_trylock(rwlock_t *lock) | 278 | int do_raw_write_trylock(rwlock_t *lock) |
279 | { | 279 | { |
280 | int ret = __raw_write_trylock(&lock->raw_lock); | 280 | int ret = arch_write_trylock(&lock->raw_lock); |
281 | 281 | ||
282 | if (ret) | 282 | if (ret) |
283 | debug_write_lock_after(lock); | 283 | debug_write_lock_after(lock); |
@@ -290,8 +290,8 @@ int _raw_write_trylock(rwlock_t *lock) | |||
290 | return ret; | 290 | return ret; |
291 | } | 291 | } |
292 | 292 | ||
293 | void _raw_write_unlock(rwlock_t *lock) | 293 | void do_raw_write_unlock(rwlock_t *lock) |
294 | { | 294 | { |
295 | debug_write_unlock(lock); | 295 | debug_write_unlock(lock); |
296 | __raw_write_unlock(&lock->raw_lock); | 296 | arch_write_unlock(&lock->raw_lock); |
297 | } | 297 | } |