Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[powerpc.git] / drivers / net / tulip / winbond-840.c
index 5b1af39..8fea2aa 100644 (file)
                        Copyright (C) 2001 Manfred Spraul
        * ethtool support (jgarzik)
        * Replace some MII-related magic numbers with constants (jgarzik)
-  
+
        TODO:
        * enable pci_power_off
        * Wake-On-LAN
 */
-  
+
 #define DRV_NAME       "winbond-840"
 #define DRV_VERSION    "1.01-d"
 #define DRV_RELDATE    "Nov-17-2001"
@@ -57,7 +57,7 @@ c-help-name: Winbond W89c840 PCI Ethernet support
 c-help-symbol: CONFIG_WINBOND_840
 c-help: This driver is for the Winbond W89c840 chip.  It also works with
 c-help: the TX9882 chip on the Compex RL100-ATX board.
-c-help: More specific information and updates are available from 
+c-help: More specific information and updates are available from
 c-help: http://www.scyld.com/network/drivers.html
 */
 
@@ -207,7 +207,7 @@ Test with 'ping -s 10000' on a fast computer.
 
 */
 
-\f
+
 
 /*
   PCI probe table.
@@ -374,7 +374,7 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static struct ethtool_ops netdev_ethtool_ops;
 static int  netdev_close(struct net_device *dev);
 
-\f
+
 
 static int __devinit w840_probe1 (struct pci_dev *pdev,
                                  const struct pci_device_id *ent)
@@ -434,7 +434,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
        np->mii_if.mdio_read = mdio_read;
        np->mii_if.mdio_write = mdio_write;
        np->base_addr = ioaddr;
-       
+
        pci_set_drvdata(pdev, dev);
 
        if (dev->mem_start)
@@ -510,7 +510,7 @@ err_out_netdev:
        return -ENODEV;
 }
 
-\f
+
 /* Read the EEPROM and MII Management Data I/O (MDIO) interfaces.  These are
    often serial bit streams generated by the host processor.
    The example below is for the common 93c46 EEPROM, 64 16 bit words. */
@@ -660,7 +660,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
        return;
 }
 
-\f
+
 static int netdev_open(struct net_device *dev)
 {
        struct netdev_private *np = netdev_priv(dev);
@@ -731,7 +731,7 @@ static int update_link(struct net_device *dev)
                                dev->name, np->phys[0]);
                netif_carrier_on(dev);
        }
-       
+
        if ((np->mii & ~0xf) == MII_DAVICOM_DM9101) {
                /* If the link partner doesn't support autonegotiation
                 * the MII detects it's abilities with the "parallel detection".
@@ -761,7 +761,7 @@ static int update_link(struct net_device *dev)
                result |= 0x20000000;
        if (result != np->csr6 && debug)
                printk(KERN_INFO "%s: Setting %dMBit-%s-duplex based on MII#%d\n",
-                                dev->name, fasteth ? 100 : 10, 
+                                dev->name, fasteth ? 100 : 10,
                                duplex ? "full" : "half", np->phys[0]);
        return result;
 }
@@ -850,7 +850,7 @@ static void init_rxtx_rings(struct net_device *dev)
                        break;
                skb->dev = dev;                 /* Mark as being used by this device. */
                np->rx_addr[i] = pci_map_single(np->pci_dev,skb->data,
-                                       skb->len,PCI_DMA_FROMDEVICE);
+                                       np->rx_buf_sz,PCI_DMA_FROMDEVICE);
 
                np->rx_ring[i].buffer1 = np->rx_addr[i];
                np->rx_ring[i].status = DescOwn;
@@ -947,7 +947,7 @@ static void init_registers(struct net_device *dev)
        iowrite32(i, ioaddr + PCIBusCfg);
 
        np->csr6 = 0;
-       /* 128 byte Tx threshold; 
+       /* 128 byte Tx threshold;
                Transmit on; Receive on; */
        update_csr6(dev, 0x00022002 | update_link(dev) | __set_rx_mode(dev));
 
@@ -1316,7 +1316,7 @@ static int netdev_rx(struct net_device *dev)
                        skb->dev = dev;                 /* Mark as being used by this device. */
                        np->rx_addr[entry] = pci_map_single(np->pci_dev,
                                                        skb->data,
-                                                       skb->len, PCI_DMA_FROMDEVICE);
+                                                       np->rx_buf_sz, PCI_DMA_FROMDEVICE);
                        np->rx_ring[entry].buffer1 = np->rx_addr[entry];
                }
                wmb();
@@ -1584,7 +1584,7 @@ static int netdev_close(struct net_device *dev)
 static void __devexit w840_remove1 (struct pci_dev *pdev)
 {
        struct net_device *dev = pci_get_drvdata(pdev);
-       
+
        if (dev) {
                struct netdev_private *np = netdev_priv(dev);
                unregister_netdev(dev);
@@ -1605,11 +1605,11 @@ static void __devexit w840_remove1 (struct pci_dev *pdev)
  * - get_stats:
  *     spin_lock_irq(np->lock), doesn't touch hw if not present
  * - hard_start_xmit:
- *     netif_stop_queue + spin_unlock_wait(&dev->xmit_lock);
+ *     synchronize_irq + netif_tx_disable;
  * - tx_timeout:
- *     netif_device_detach + spin_unlock_wait(&dev->xmit_lock);
+ *     netif_device_detach + netif_tx_disable;
  * - set_multicast_list
- *     netif_device_detach + spin_unlock_wait(&dev->xmit_lock);
+ *     netif_device_detach + netif_tx_disable;
  * - interrupt handler
  *     doesn't touch hw if not present, synchronize_irq waits for
  *     running instances of the interrupt handler.
@@ -1635,17 +1635,16 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state)
                netif_device_detach(dev);
                update_csr6(dev, 0);
                iowrite32(0, ioaddr + IntrEnable);
-               netif_stop_queue(dev);
                spin_unlock_irq(&np->lock);
 
-               spin_unlock_wait(&dev->xmit_lock);
                synchronize_irq(dev->irq);
+               netif_tx_disable(dev);
        
                np->stats.rx_missed_errors += ioread32(ioaddr + RxMissed) & 0xffff;
 
                /* no more hardware accesses behind this line. */
 
-               if (np->csr6) BUG();
+               BUG_ON(np->csr6);
                if (ioread32(ioaddr + IntrEnable)) BUG();
 
                /* pci_power_off(pdev, -1); */