bonding: fix enslavement error unwinds
[safe/jmp/linux-2.6] / drivers / net / amd8111e.c
index afb60a5..85f7276 100644 (file)
@@ -709,7 +709,8 @@ static int amd8111e_tx(struct net_device *dev)
                lp->tx_complete_idx++;
                /*COAL update tx coalescing parameters */
                lp->coal_conf.tx_packets++;
-               lp->coal_conf.tx_bytes += lp->tx_ring[tx_index].buff_count;
+               lp->coal_conf.tx_bytes +=
+                       le16_to_cpu(lp->tx_ring[tx_index].buff_count);
 
                if (netif_queue_stopped(dev) &&
                        lp->tx_complete_idx > lp->tx_idx - NUM_TX_BUFFERS +2){
@@ -1110,7 +1111,7 @@ static struct net_device_stats *amd8111e_get_stats(struct net_device * dev)
 
        return new_stats;
 }
-/* This function recalculate the interupt coalescing  mode on every interrupt
+/* This function recalculate the interrupt coalescing  mode on every interrupt
 according to the datarate and the packet rate.
 */
 static int amd8111e_calc_coalesce(struct net_device *dev)
@@ -1339,7 +1340,9 @@ static int amd8111e_close(struct net_device * dev)
        struct amd8111e_priv *lp = netdev_priv(dev);
        netif_stop_queue(dev);
 
+#ifdef CONFIG_AMD8111E_NAPI
        napi_disable(&lp->napi);
+#endif
 
        spin_lock_irq(&lp->lock);
 
@@ -1371,7 +1374,9 @@ static int amd8111e_open(struct net_device * dev )
                                         dev->name, dev))
                return -EAGAIN;
 
+#ifdef CONFIG_AMD8111E_NAPI
        napi_enable(&lp->napi);
+#endif
 
        spin_lock_irq(&lp->lock);
 
@@ -1379,7 +1384,9 @@ static int amd8111e_open(struct net_device * dev )
 
        if(amd8111e_restart(dev)){
                spin_unlock_irq(&lp->lock);
+#ifdef CONFIG_AMD8111E_NAPI
                napi_disable(&lp->napi);
+#endif
                if (dev->irq)
                        free_irq(dev->irq, dev);
                return -ENOMEM;
@@ -1404,7 +1411,7 @@ This function checks if there is any transmit  descriptors available to queue mo
 static int amd8111e_tx_queue_avail(struct amd8111e_priv* lp )
 {
        int tx_index = lp->tx_idx & TX_BUFF_MOD_MASK;
-       if(lp->tx_skbuff[tx_index] != 0)
+       if (lp->tx_skbuff[tx_index])
                return -1;
        else
                return 0;
@@ -1441,7 +1448,7 @@ static int amd8111e_start_xmit(struct sk_buff *skb, struct net_device * dev)
        lp->tx_dma_addr[tx_index] =
            pci_map_single(lp->pci_dev, skb->data, skb->len, PCI_DMA_TODEVICE);
        lp->tx_ring[tx_index].buff_phy_addr =
-           (u32) cpu_to_le32(lp->tx_dma_addr[tx_index]);
+           cpu_to_le32(lp->tx_dma_addr[tx_index]);
 
        /*  Set FCS and LTINT bits */
        wmb();
@@ -1934,16 +1941,17 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
        unsigned long reg_addr,reg_len;
        struct amd8111e_priv* lp;
        struct net_device* dev;
+       DECLARE_MAC_BUF(mac);
 
        err = pci_enable_device(pdev);
        if(err){
-               printk(KERN_ERR "amd8111e: Cannot enable new PCI device,"
+               printk(KERN_ERR "amd8111e: Cannot enable new PCI device, "
                        "exiting.\n");
                return err;
        }
 
        if(!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)){
-               printk(KERN_ERR "amd8111e: Cannot find PCI base address"
+               printk(KERN_ERR "amd8111e: Cannot find PCI base address"
                       "exiting.\n");
                err = -ENODEV;
                goto err_disable_pdev;
@@ -1997,7 +2005,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
        spin_lock_init(&lp->lock);
 
        lp->mmio = ioremap(reg_addr, reg_len);
-       if (lp->mmio == 0) {
+       if (!lp->mmio) {
                printk(KERN_ERR "amd8111e: Cannot map device registers, "
                       "exiting\n");
                err = -ENOMEM;
@@ -2006,7 +2014,7 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
 
        /* Initializing MAC address */
        for(i = 0; i < ETH_ADDR_LEN; i++)
-                       dev->dev_addr[i] =readb(lp->mmio + PADR + i);
+               dev->dev_addr[i] = readb(lp->mmio + PADR + i);
 
        /* Setting user defined parametrs */
        lp->ext_phy_option = speed_duplex[card_idx];
@@ -2075,11 +2083,10 @@ static int __devinit amd8111e_probe_one(struct pci_dev *pdev,
        /*  display driver and device information */
 
        chip_version = (readl(lp->mmio + CHIPID) & 0xf0000000)>>28;
-       printk(KERN_INFO "%s: AMD-8111e Driver Version: %s\n",                                                           dev->name,MODULE_VERS);
-       printk(KERN_INFO "%s: [ Rev %x ] PCI 10/100BaseT Ethernet ",                                                    dev->name, chip_version);
-       for (i = 0; i < 6; i++)
-               printk("%2.2x%c",dev->dev_addr[i],i == 5 ? ' ' : ':');
-       printk( "\n");
+       printk(KERN_INFO "%s: AMD-8111e Driver Version: %s\n",
+              dev->name,MODULE_VERS);
+       printk(KERN_INFO "%s: [ Rev %x ] PCI 10/100BaseT Ethernet %s\n",
+              dev->name, chip_version, print_mac(mac, dev->dev_addr));
        if (lp->ext_phy_id)
                printk(KERN_INFO "%s: Found MII PHY ID 0x%08x at address 0x%02x\n",
                       dev->name, lp->ext_phy_id, lp->ext_phy_addr);