powerpc: Fix spin_event_timeout() to be robust over context switches
authorGrant Likely <grant.likely@secretlab.ca>
Mon, 29 Jun 2009 13:40:51 +0000 (13:40 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 8 Jul 2009 03:50:24 +0000 (13:50 +1000)
commitad9064d5e22a6a24f828dad63c4775c4d7280bd4
treed3e91b73dd737efa36cdb8191069dc200a5a79e5
parent30c5af435b2e3e5700b0e4a53ac37a39b3b3516e
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>
arch/powerpc/include/asm/delay.h