diff options
Diffstat (limited to 'lib/spinlock_debug.c')
-rw-r--r-- | lib/spinlock_debug.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c index 58c577dd82e5..dafaf1de2491 100644 --- a/lib/spinlock_debug.c +++ b/lib/spinlock_debug.c | |||
@@ -99,11 +99,12 @@ static inline void debug_spin_unlock(spinlock_t *lock) | |||
99 | 99 | ||
100 | static void __spin_lock_debug(spinlock_t *lock) | 100 | static void __spin_lock_debug(spinlock_t *lock) |
101 | { | 101 | { |
102 | int print_once = 1; | ||
103 | u64 i; | 102 | u64 i; |
103 | u64 loops = loops_per_jiffy * HZ; | ||
104 | int print_once = 1; | ||
104 | 105 | ||
105 | for (;;) { | 106 | for (;;) { |
106 | for (i = 0; i < loops_per_jiffy * HZ; i++) { | 107 | for (i = 0; i < loops; i++) { |
107 | if (__raw_spin_trylock(&lock->raw_lock)) | 108 | if (__raw_spin_trylock(&lock->raw_lock)) |
108 | return; | 109 | return; |
109 | __delay(1); | 110 | __delay(1); |
@@ -165,11 +166,12 @@ static void rwlock_bug(rwlock_t *lock, const char *msg) | |||
165 | #if 0 /* __write_lock_debug() can lock up - maybe this can too? */ | 166 | #if 0 /* __write_lock_debug() can lock up - maybe this can too? */ |
166 | static void __read_lock_debug(rwlock_t *lock) | 167 | static void __read_lock_debug(rwlock_t *lock) |
167 | { | 168 | { |
168 | int print_once = 1; | ||
169 | u64 i; | 169 | u64 i; |
170 | u64 loops = loops_per_jiffy * HZ; | ||
171 | int print_once = 1; | ||
170 | 172 | ||
171 | for (;;) { | 173 | for (;;) { |
172 | for (i = 0; i < loops_per_jiffy * HZ; i++) { | 174 | for (i = 0; i < loops; i++) { |
173 | if (__raw_read_trylock(&lock->raw_lock)) | 175 | if (__raw_read_trylock(&lock->raw_lock)) |
174 | return; | 176 | return; |
175 | __delay(1); | 177 | __delay(1); |
@@ -239,11 +241,12 @@ static inline void debug_write_unlock(rwlock_t *lock) | |||
239 | #if 0 /* This can cause lockups */ | 241 | #if 0 /* This can cause lockups */ |
240 | static void __write_lock_debug(rwlock_t *lock) | 242 | static void __write_lock_debug(rwlock_t *lock) |
241 | { | 243 | { |
242 | int print_once = 1; | ||
243 | u64 i; | 244 | u64 i; |
245 | u64 loops = loops_per_jiffy * HZ; | ||
246 | int print_once = 1; | ||
244 | 247 | ||
245 | for (;;) { | 248 | for (;;) { |
246 | for (i = 0; i < loops_per_jiffy * HZ; i++) { | 249 | for (i = 0; i < loops; i++) { |
247 | if (__raw_write_trylock(&lock->raw_lock)) | 250 | if (__raw_write_trylock(&lock->raw_lock)) |
248 | return; | 251 | return; |
249 | __delay(1); | 252 | __delay(1); |