From: Grant Likely Date: Mon, 29 Jun 2009 13:40:51 +0000 (+0000) Subject: powerpc: Fix spin_event_timeout() to be robust over context switches X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ad9064d5e22a6a24f828dad63c4775c4d7280bd4;p=linux.git 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 Acked-by: Timur Tabi Signed-off-by: Benjamin Herrenschmidt --- diff --git a/arch/powerpc/include/asm/delay.h b/arch/powerpc/include/asm/delay.h index 1e2eb41fa0577..52e4d54da2a98 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); udelay(delay); \ else \ cpu_relax(); \ + if (!__ret) \ + __ret = (condition); \ __ret; \ })