aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2009-06-29 09:40:51 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-07-07 23:50:24 -0400
commitad9064d5e22a6a24f828dad63c4775c4d7280bd4 (patch)
treed3e91b73dd737efa36cdb8191069dc200a5a79e5
parent30c5af435b2e3e5700b0e4a53ac37a39b3b3516e (diff)
powerpc: Fix spin_event_timeout() to be robust over context switches
Current implementation of spin_event_timeout can be interrupted by an IRQ or context switch after testing the condition, but before checking the timeout. This can cause the loop to report a timeout when the condition actually became true in the middle. This patch adds one final check of the condition upon exit of the loop if the last test of the condition was still false. Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Acked-by: Timur Tabi <timur@freescale.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/include/asm/delay.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/delay.h b/arch/powerpc/include/asm/delay.h
index 1e2eb41fa057..52e4d54da2a9 100644
--- a/arch/powerpc/include/asm/delay.h
+++ b/arch/powerpc/include/asm/delay.h
@@ -63,6 +63,8 @@ extern void udelay(unsigned long usecs);
63 udelay(delay); \ 63 udelay(delay); \
64 else \ 64 else \
65 cpu_relax(); \ 65 cpu_relax(); \
66 if (!__ret) \
67 __ret = (condition); \
66 __ret; \ 68 __ret; \
67}) 69})
68 70