[PATCH] 3c59x: avoid blindly reading link status twice
authorTommy Christensen <tommy.christensen@tpack.net>
Mon, 7 Nov 2005 08:58:04 +0000 (00:58 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 7 Nov 2005 15:53:25 +0000 (07:53 -0800)
In order to spare some I/O operations, be more intelligent about when to
read from the PHY.

Pointed out by Bogdan Costescu.

Signed-off-by: Tommy S. Christensen <tommy.christensen@tpack.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/net/3c59x.c

index 88ce4c43fd4f8ce8277c61679970c6f66d7c8fa6..e1f773d07edb5f67f246c84f6be630c2e38c122e 100644 (file)
@@ -1893,7 +1893,10 @@ vortex_timer(unsigned long data)
                {
                        spin_lock_bh(&vp->lock);
                        mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
-                       mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
+                       if (!(mii_status & BMSR_LSTATUS)) {
+                               /* Re-read to get actual link status */
+                               mii_status = mdio_read(dev, vp->phys[0], MII_BMSR);
+                       }
                        ok = 1;
                        if (vortex_debug > 2)
                                printk(KERN_DEBUG "%s: MII transceiver has status %4.4x.\n",