]> git.hungrycats.org Git - linux/commitdiff
Update pci-skeleton net driver:
authorJeff Garzik <jgarzik@rum.normnet.org>
Wed, 6 Feb 2002 23:24:15 +0000 (18:24 -0500)
committerJeff Garzik <jgarzik@rum.normnet.org>
Wed, 6 Feb 2002 23:24:15 +0000 (18:24 -0500)
Replace MII-related magic numbers with meaningful constants
listed in linux/mii.h.

drivers/net/pci-skeleton.c

index 6743227a3478085d2a0f221bbd39239737b26c8e..d221bb76e461a6f26d43cd9377724f1a45faaeec 100644 (file)
@@ -834,7 +834,7 @@ static int __devinit netdrv_init_one (struct pci_dev *pdev,
                printk (KERN_INFO
                        "%s: Media type forced to Full Duplex.\n",
                        dev->name);
-               mdio_write (dev, tp->phys[0], 4, 0x141);
+               mdio_write (dev, tp->phys[0], MII_ADVERTISE, ADVERTISE_FULL);
                tp->duplex_lock = 1;
        }
 
@@ -1235,20 +1235,20 @@ static void netdrv_timer (unsigned long data)
        struct netdrv_private *tp = dev->priv;
        void *ioaddr = tp->mmio_addr;
        int next_tick = 60 * HZ;
-       int mii_reg5;
+       int mii_lpa;
 
-       mii_reg5 = mdio_read (dev, tp->phys[0], 5);
+       mii_lpa = mdio_read (dev, tp->phys[0], MII_LPA);
 
-       if (!tp->duplex_lock && mii_reg5 != 0xffff) {
-               int duplex = (mii_reg5 & 0x0100)
-                   || (mii_reg5 & 0x01C0) == 0x0040;
+       if (!tp->duplex_lock && mii_lpa != 0xffff) {
+               int duplex = (mii_lpa & LPA_100FULL)
+                   || (mii_lpa & 0x01C0) == 0x0040;
                if (tp->full_duplex != duplex) {
                        tp->full_duplex = duplex;
                        printk (KERN_INFO
                                "%s: Setting %s-duplex based on MII #%d link"
                                " partner ability of %4.4x.\n", dev->name,
                                tp->full_duplex ? "full" : "half",
-                               tp->phys[0], mii_reg5);
+                               tp->phys[0], mii_lpa);
                        NETDRV_W8 (Cfg9346, Cfg9346_Unlock);
                        NETDRV_W8 (Config1, tp->full_duplex ? 0x60 : 0x20);
                        NETDRV_W8 (Cfg9346, Cfg9346_Lock);