aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Johnson <djohnson+linux-mips@sw.starentnetworks.com>2007-03-05 20:50:27 -0500
committerRalf Baechle <ralf@linux-mips.org>2007-03-06 19:07:17 -0500
commitd52c2d5a626a2cb1848fa7063b3ab79e2752dac7 (patch)
treede525a4b04f3710d965a662f26d402e872a21247
parentd0c91ae2bb3df9d7bef279d8f400e0c8ddde0b5e (diff)
[MIPS] Fix __raw_read_trylock() to allow multiple readers
A deadlock can occur for mixed irq and non-irq rwlock readers if a 2nd reader attempts to take lock by looping around __raw_read_trylock(). Signed-off-by: Dave Johnson <djohnson+linux-mips@sw.starentnetworks.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--include/asm-mips/spinlock.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/asm-mips/spinlock.h b/include/asm-mips/spinlock.h
index f1755d28a36a..35e431cd796b 100644
--- a/include/asm-mips/spinlock.h
+++ b/include/asm-mips/spinlock.h
@@ -287,7 +287,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
287 " .set noreorder # __raw_read_trylock \n" 287 " .set noreorder # __raw_read_trylock \n"
288 " li %2, 0 \n" 288 " li %2, 0 \n"
289 "1: ll %1, %3 \n" 289 "1: ll %1, %3 \n"
290 " bnez %1, 2f \n" 290 " bltz %1, 2f \n"
291 " addu %1, 1 \n" 291 " addu %1, 1 \n"
292 " sc %1, %0 \n" 292 " sc %1, %0 \n"
293 " .set reorder \n" 293 " .set reorder \n"
@@ -304,7 +304,7 @@ static inline int __raw_read_trylock(raw_rwlock_t *rw)
304 " .set noreorder # __raw_read_trylock \n" 304 " .set noreorder # __raw_read_trylock \n"
305 " li %2, 0 \n" 305 " li %2, 0 \n"
306 "1: ll %1, %3 \n" 306 "1: ll %1, %3 \n"
307 " bnez %1, 2f \n" 307 " bltz %1, 2f \n"
308 " addu %1, 1 \n" 308 " addu %1, 1 \n"
309 " sc %1, %0 \n" 309 " sc %1, %0 \n"
310 " beqz %1, 1b \n" 310 " beqz %1, 1b \n"