]> git.hungrycats.org Git - linux/commitdiff
Update eepro100 net driver link state tracking:
authorJeff Garzik <jgarzik@rum.normnet.org>
Fri, 8 Feb 2002 13:38:05 +0000 (08:38 -0500)
committerJeff Garzik <jgarzik@rum.normnet.org>
Fri, 8 Feb 2002 13:38:05 +0000 (08:38 -0500)
* Initialize interface carrier state in speedo_open.
* Update previous netif_carrier_{on,off} change to use
  linux/mii.h constants.

Contributor: Andrew Morton, with modifications from me

drivers/net/eepro100.c

index 106343da1b9cebb7045b0b4e7c5a27e06f5767df..c670ba07f8aaace82b2d51421f2c49b42c1f9eb7 100644 (file)
@@ -991,6 +991,11 @@ speedo_open(struct net_device *dev)
        if ((sp->phy[0] & 0x8000) == 0)
                sp->advertising = mdio_read(ioaddr, sp->phy[0] & 0x1f, 4);
 
+       if (mdio_read(ioaddr, sp->phy[0] & 0x1f, MII_BMSR) & BMSR_LSTATUS)
+               netif_carrier_on(dev);
+       else
+               netif_carrier_off(dev);
+
        if (speedo_debug > 2) {
                printk(KERN_DEBUG "%s: Done speedo_open(), status %8.8x.\n",
                           dev->name, inw(ioaddr + SCBStatus));
@@ -1102,7 +1107,7 @@ static void speedo_timer(unsigned long data)
                        /* Clear sticky bit. */
                        mdio_read(ioaddr, phy_num, 1);
                        /* If link beat has returned... */
-                       if (mdio_read(ioaddr, phy_num, 1) & 0x0004)
+                       if (mdio_read(ioaddr, phy_num, MII_BMSR) & BMSR_LSTATUS)
                                netif_carrier_on(dev);
                        else
                                netif_carrier_off(dev);