Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / net / tulip / de4x5.c
index d59d46e..f560941 100644 (file)
 #include <linux/ctype.h>
 #include <linux/dma-mapping.h>
 #include <linux/moduleparam.h>
+#include <linux/bitops.h>
 
-#include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/dma.h>
 #include <asm/byteorder.h>
@@ -513,7 +513,7 @@ struct mii_phy {
     u_char  *rst;           /* Start of reset sequence in SROM           */
     u_int mc;               /* Media Capabilities                        */
     u_int ana;              /* NWay Advertisement                        */
-    u_int fdx;              /* Full DupleX capabilites for each media    */
+    u_int fdx;              /* Full DupleX capabilities for each media   */
     u_int ttm;              /* Transmit Threshold Mode for each media    */
     u_int mci;              /* 21142 MII Connector Interrupt info        */
 };
@@ -1141,7 +1141,7 @@ de4x5_hw_init(struct net_device *dev, u_long iobase, struct device *gendev)
        lp->asBitValid = TRUE;
        lp->timeout = -1;
        lp->gendev = gendev;
-       lp->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
+       spin_lock_init(&lp->lock);
        init_timer(&lp->timer);
        de4x5_parse_params(dev);
 
@@ -1316,7 +1316,7 @@ de4x5_open(struct net_device *dev)
     ** Re-initialize the DE4X5... 
     */
     status = de4x5_init(dev);
-    lp->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
+    spin_lock_init(&lp->lock);
     lp->state = OPEN;
     de4x5_dbg_open(dev);
     
@@ -2124,6 +2124,7 @@ static struct eisa_driver de4x5_eisa_driver = {
                 .remove  = __devexit_p (de4x5_eisa_remove),
         }
 };
+MODULE_DEVICE_TABLE(eisa, de4x5_eisa_ids);
 #endif
 
 #ifdef CONFIG_PCI
@@ -2143,9 +2144,9 @@ srom_search(struct net_device *dev, struct pci_dev *pdev)
     u_long iobase = 0;                     /* Clear upper 32 bits in Alphas */
     int i, j, cfrv;
     struct de4x5_private *lp = netdev_priv(dev);
-    struct list_head *walk = &pdev->bus_list;
+    struct list_head *walk;
 
-    for (walk = walk->next; walk != &pdev->bus_list; walk = walk->next) {
+    list_for_each(walk, &pdev->bus_list) {
        struct pci_dev *this_dev = pci_dev_b(walk);
 
        /* Skip the pci_bus list entry */
@@ -2242,8 +2243,13 @@ static int __devinit de4x5_pci_probe (struct pci_dev *pdev,
                return -ENODEV;
 
        /* Ok, the device seems to be for us. */
-       if (!(dev = alloc_etherdev (sizeof (struct de4x5_private))))
-               return -ENOMEM;
+       if ((error = pci_enable_device (pdev)))
+               return error;
+
+       if (!(dev = alloc_etherdev (sizeof (struct de4x5_private)))) {
+               error = -ENOMEM;
+               goto disable_dev;
+       }
 
        lp = netdev_priv(dev);
        lp->bus = PCI;
@@ -2327,6 +2333,8 @@ static int __devinit de4x5_pci_probe (struct pci_dev *pdev,
        release_region (iobase, DE4X5_PCI_TOTAL_SIZE);
  free_dev:
        free_netdev (dev);
+ disable_dev:
+       pci_disable_device (pdev);
        return error;
 }
 
@@ -2341,6 +2349,7 @@ static void __devexit de4x5_pci_remove (struct pci_dev *pdev)
        unregister_netdev (dev);
        free_netdev (dev);
        release_region (iobase, DE4X5_PCI_TOTAL_SIZE);
+       pci_disable_device (pdev);
 }
 
 static struct pci_device_id de4x5_pci_tbl[] = {
@@ -4151,7 +4160,7 @@ get_hw_addr(struct net_device *dev)
     ** If the address starts with 00 a0, we have to bit-reverse
     ** each byte of the address.
     */
-    if ( (_machine & _MACH_Pmac) &&
+    if ( machine_is(powermac) &&
         (dev->dev_addr[0] == 0) &&
         (dev->dev_addr[1] == 0xa0) )
     {
@@ -4721,8 +4730,8 @@ type1_infoblock(struct net_device *dev, u_char count, u_char *p)
     if (lp->state == INITIALISED) {
         lp->ibn = 1;
        lp->active = *p++;
-       lp->phy[lp->active].gep = (*p ? p : 0); p += (*p + 1);
-       lp->phy[lp->active].rst = (*p ? p : 0); p += (*p + 1);
+       lp->phy[lp->active].gep = (*p ? p : NULL); p += (*p + 1);
+       lp->phy[lp->active].rst = (*p ? p : NULL); p += (*p + 1);
        lp->phy[lp->active].mc  = TWIDDLE(p); p += 2;
        lp->phy[lp->active].ana = TWIDDLE(p); p += 2;
        lp->phy[lp->active].fdx = TWIDDLE(p); p += 2;
@@ -4802,8 +4811,8 @@ type3_infoblock(struct net_device *dev, u_char count, u_char *p)
         lp->ibn = 3;
         lp->active = *p++;
        if (MOTO_SROM_BUG) lp->active = 0;
-       lp->phy[lp->active].gep = (*p ? p : 0); p += (2 * (*p) + 1);
-       lp->phy[lp->active].rst = (*p ? p : 0); p += (2 * (*p) + 1);
+       lp->phy[lp->active].gep = (*p ? p : NULL); p += (2 * (*p) + 1);
+       lp->phy[lp->active].rst = (*p ? p : NULL); p += (2 * (*p) + 1);
        lp->phy[lp->active].mc  = TWIDDLE(p); p += 2;
        lp->phy[lp->active].ana = TWIDDLE(p); p += 2;
        lp->phy[lp->active].fdx = TWIDDLE(p); p += 2;
@@ -5081,7 +5090,7 @@ mii_get_phy(struct net_device *dev)
     lp->useMII = TRUE;
 
     /* Search the MII address space for possible PHY devices */
-    for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(++i)%DE4X5_MAX_MII) {
+    for (n=0, lp->mii_cnt=0, i=1; !((i==1) && (n==1)); i=(i+1)%DE4X5_MAX_MII) {
        lp->phy[lp->active].addr = i;
        if (i==0) n++;                             /* Count cycles */
        while (de4x5_reset_phy(dev)<0) udelay(100);/* Wait for reset */