b43legacy: fix DMA slot resource leakage
[safe/jmp/linux-2.6] / drivers / net / tulip / winbond-840.c
index 5b71ac7..35d0cfc 100644 (file)
@@ -354,6 +354,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
        int irq;
        int i, option = find_cnt < MAX_UNITS ? options[find_cnt] : 0;
        void __iomem *ioaddr;
+       DECLARE_MAC_BUF(mac);
 
        i = pci_enable_device(pdev);
        if (i) return i;
@@ -370,7 +371,6 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
        dev = alloc_etherdev(sizeof(*np));
        if (!dev)
                return -ENOMEM;
-       SET_MODULE_OWNER(dev);
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        if (pci_request_regions(pdev, DRV_NAME))
@@ -381,7 +381,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
                goto err_out_free_res;
 
        for (i = 0; i < 3; i++)
-               ((u16 *)dev->dev_addr)[i] = le16_to_cpu(eeprom_read(ioaddr, i));
+               ((__le16 *)dev->dev_addr)[i] = cpu_to_le16(eeprom_read(ioaddr, i));
 
        /* Reset the chip to erase previous misconfiguration.
           No hold time required! */
@@ -434,11 +434,9 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
        if (i)
                goto err_out_cleardev;
 
-       printk(KERN_INFO "%s: %s at %p, ",
-                  dev->name, pci_id_tbl[chip_idx].name, ioaddr);
-       for (i = 0; i < 5; i++)
-                       printk("%2.2x:", dev->dev_addr[i]);
-       printk("%2.2x, IRQ %d.\n", dev->dev_addr[i], irq);
+       printk(KERN_INFO "%s: %s at %p, %s, IRQ %d.\n",
+              dev->name, pci_id_tbl[chip_idx].name, ioaddr,
+              print_mac(mac, dev->dev_addr), irq);
 
        if (np->drv_flags & CanHaveMII) {
                int phy, phy_idx = 0;
@@ -485,7 +483,7 @@ err_out_netdev:
    a delay.  Note that pre-2.0.34 kernels had a cache-alignment bug that
    made udelay() unreliable.
    The old method of using an ISA access as a delay, __SLOW_DOWN_IO__, is
-   depricated.
+   deprecated.
 */
 #define eeprom_delay(ee_addr)  ioread32(ee_addr)
 
@@ -1021,7 +1019,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
                np->tx_ring[entry].length |= DescEndRing;
 
        /* Now acquire the irq spinlock.
-        * The difficult race is the the ordering between
+        * The difficult race is the ordering between
         * increasing np->cur_tx and setting DescOwned:
         * - if np->cur_tx is increased first the interrupt
         *   handler could consider the packet as transmitted
@@ -1147,7 +1145,7 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                }
 
                /* Abnormal error summary/uncommon events handlers. */
-               if (intr_status & (AbnormalIntr | TxFIFOUnderflow | SytemError |
+               if (intr_status & (AbnormalIntr | TxFIFOUnderflow | SystemError |
                                                   TimerInt | TxDied))
                        netdev_error(dev, intr_status);
 
@@ -1232,7 +1230,7 @@ static int netdev_rx(struct net_device *dev)
                                pci_dma_sync_single_for_cpu(np->pci_dev,np->rx_addr[entry],
                                                            np->rx_skbuff[entry]->len,
                                                            PCI_DMA_FROMDEVICE);
-                               eth_copy_and_sum(skb, np->rx_skbuff[entry]->data, pkt_len, 0);
+                               skb_copy_to_linear_data(skb, np->rx_skbuff[entry]->data, pkt_len);
                                skb_put(skb, pkt_len);
                                pci_dma_sync_single_for_device(np->pci_dev,np->rx_addr[entry],
                                                               np->rx_skbuff[entry]->len,
@@ -1246,16 +1244,16 @@ static int netdev_rx(struct net_device *dev)
                        }
 #ifndef final_version                          /* Remove after testing. */
                        /* You will want this info for the initial debug. */
-                       if (debug > 5)
-                               printk(KERN_DEBUG "  Rx data %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:"
-                                          "%2.2x %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x %2.2x%2.2x "
-                                          "%d.%d.%d.%d.\n",
-                                          skb->data[0], skb->data[1], skb->data[2], skb->data[3],
-                                          skb->data[4], skb->data[5], skb->data[6], skb->data[7],
-                                          skb->data[8], skb->data[9], skb->data[10],
-                                          skb->data[11], skb->data[12], skb->data[13],
-                                          skb->data[14], skb->data[15], skb->data[16],
-                                          skb->data[17]);
+                       if (debug > 5) {
+                               DECLARE_MAC_BUF(mac);
+                               DECLARE_MAC_BUF(mac2);
+
+                               printk(KERN_DEBUG "  Rx data %s %s"
+                                      " %2.2x%2.2x %d.%d.%d.%d.\n",
+                                      print_mac(mac, &skb->data[0]), print_mac(mac2, &skb->data[6]),
+                                      skb->data[12], skb->data[13],
+                                      skb->data[14], skb->data[15], skb->data[16], skb->data[17]);
+                       }
 #endif
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_rx(skb);
@@ -1452,8 +1450,6 @@ static const struct ethtool_ops netdev_ethtool_ops = {
        .get_link               = netdev_get_link,
        .get_msglevel           = netdev_get_msglevel,
        .set_msglevel           = netdev_set_msglevel,
-       .get_sg                 = ethtool_op_get_sg,
-       .get_tx_csum            = ethtool_op_get_tx_csum,
 };
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)