]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mv643xx_eth: fix SMI bus access timeouts
authorLennert Buytenhek <buytenh@wantstofly.org>
Sat, 1 Nov 2008 05:32:20 +0000 (06:32 +0100)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 3 Nov 2008 20:23:15 +0000 (15:23 -0500)
The mv643xx_eth mii bus implementation uses wait_event_timeout() to
wait for SMI completion interrupts.

If wait_event_timeout() would return zero, mv643xx_eth would conclude
that the SMI access timed out, but this is not necessarily true --
wait_event_timeout() can also return zero in the case where the SMI
completion interrupt did happen in time but where it took longer than
the requested timeout for the process performing the SMI access to be
scheduled again.  This would lead to occasional SMI access timeouts
when the system would be under heavy load.

The fix is to ignore the return value of wait_event_timeout(), and
to re-check the SMI done bit after wait_event_timeout() returns to
determine whether or not the SMI access timed out.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/net/mv643xx_eth.c

index a9c8c08044b1847ebe560964433ad3ee4a564322..b9dcdbd369f87b87e5e9e12650e50d7ada6d9465 100644 (file)
@@ -1066,9 +1066,12 @@ static int smi_wait_ready(struct mv643xx_eth_shared_private *msp)
                return 0;
        }
 
-       if (!wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp),
-                               msecs_to_jiffies(100)))
-               return -ETIMEDOUT;
+       if (!smi_is_done(msp)) {
+               wait_event_timeout(msp->smi_busy_wait, smi_is_done(msp),
+                                  msecs_to_jiffies(100));
+               if (!smi_is_done(msp))
+                       return -ETIMEDOUT;
+       }
 
        return 0;
 }