From: Tommy Christensen Date: Mon, 7 Nov 2005 08:58:04 +0000 (-0800) Subject: [PATCH] 3c59x: avoid blindly reading link status twice X-Git-Tag: Ubuntu-goldfish-3.4.0-4.27~38285 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=d9e46de34e4212f472684b1561ba323aac54ea25;p=mirror_ubuntu-zesty-kernel.git [PATCH] 3c59x: avoid blindly reading link status twice 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 88ce4c43fd4f..e1f773d07edb 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c @@ -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",