drivers/net: request_irq - Remove unnecessary leading & from second arg
[safe/jmp/linux-2.6] / drivers / net / tulip / winbond-840.c
index 5b71ac7..1a52729 100644 (file)
@@ -107,8 +107,6 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* Time in jiffies before concluding the transmitter is hung. */
 #define TX_TIMEOUT  (2*HZ)
 
-#define PKT_BUF_SZ             1536                    /* Size of each temporary Rx buffer.*/
-
 /* Include files, designed to support most kernel versions 2.0.0 and later. */
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -137,10 +135,14 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 
 #include "tulip.h"
 
+#undef PKT_BUF_SZ                      /* tulip.h also defines this */
+#define PKT_BUF_SZ             1536    /* Size of each temporary Rx buffer.*/
+
 /* These identify the driver base version and may not be removed. */
-static char version[] =
-KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " DRV_RELDATE "  Donald Becker <becker@scyld.com>\n"
-KERN_INFO "  http://www.scyld.com/network/drivers.html\n";
+static const char version[] __initconst =
+       KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) "
+       DRV_RELDATE "  Donald Becker <becker@scyld.com>\n"
+       "  http://www.scyld.com/network/drivers.html\n";
 
 MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
 MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver");
@@ -331,7 +333,7 @@ static void init_registers(struct net_device *dev);
 static void tx_timeout(struct net_device *dev);
 static int alloc_ringdesc(struct net_device *dev);
 static void free_ringdesc(struct netdev_private *np);
-static int  start_tx(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t intr_handler(int irq, void *dev_instance);
 static void netdev_error(struct net_device *dev, int intr_status);
 static int  netdev_rx(struct net_device *dev);
@@ -342,7 +344,18 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
 static const struct ethtool_ops netdev_ethtool_ops;
 static int  netdev_close(struct net_device *dev);
 
-
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = netdev_open,
+       .ndo_stop               = netdev_close,
+       .ndo_start_xmit         = start_tx,
+       .ndo_get_stats          = get_stats,
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_do_ioctl           = netdev_ioctl,
+       .ndo_tx_timeout         = tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
 
 static int __devinit w840_probe1 (struct pci_dev *pdev,
                                  const struct pci_device_id *ent)
@@ -362,7 +375,7 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
 
        irq = pdev->irq;
 
-       if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_WARNING "Winbond-840: Device %s disabled due to DMA limitations.\n",
                       pci_name(pdev));
                return -EIO;
@@ -370,7 +383,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 +393,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! */
@@ -420,25 +432,17 @@ static int __devinit w840_probe1 (struct pci_dev *pdev,
                np->mii_if.force_media = 1;
 
        /* The chip-specific entries in the device structure. */
-       dev->open = &netdev_open;
-       dev->hard_start_xmit = &start_tx;
-       dev->stop = &netdev_close;
-       dev->get_stats = &get_stats;
-       dev->set_multicast_list = &set_rx_mode;
-       dev->do_ioctl = &netdev_ioctl;
+       dev->netdev_ops = &netdev_ops;
        dev->ethtool_ops = &netdev_ethtool_ops;
-       dev->tx_timeout = &tx_timeout;
        dev->watchdog_timeo = TX_TIMEOUT;
 
        i = register_netdev(dev);
        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, %pM, IRQ %d.\n",
+              dev->name, pci_id_tbl[chip_idx].name, ioaddr,
+              dev->dev_addr, irq);
 
        if (np->drv_flags & CanHaveMII) {
                int phy, phy_idx = 0;
@@ -485,7 +489,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)
 
@@ -635,7 +639,7 @@ static int netdev_open(struct net_device *dev)
        iowrite32(0x00000001, ioaddr + PCIBusCfg);              /* Reset */
 
        netif_device_detach(dev);
-       i = request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev);
+       i = request_irq(dev->irq, intr_handler, IRQF_SHARED, dev->name, dev);
        if (i)
                goto out_err;
 
@@ -935,7 +939,7 @@ static void tx_timeout(struct net_device *dev)
                printk(KERN_DEBUG "  Rx ring %p: ", np->rx_ring);
                for (i = 0; i < RX_RING_SIZE; i++)
                        printk(" %8.8x", (unsigned int)np->rx_ring[i].status);
-               printk("\n"KERN_DEBUG"  Tx ring %p: ", np->tx_ring);
+               printk(KERN_DEBUG"  Tx ring %p: ", np->tx_ring);
                for (i = 0; i < TX_RING_SIZE; i++)
                        printk(" %8.8x", np->tx_ring[i].status);
                printk("\n");
@@ -993,7 +997,7 @@ static void free_ringdesc(struct netdev_private *np)
 
 }
 
-static int start_tx(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
 {
        struct netdev_private *np = netdev_priv(dev);
        unsigned entry;
@@ -1021,7 +1025,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
@@ -1054,7 +1058,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
                printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
                           dev->name, np->cur_tx, entry);
        }
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static void netdev_tx_done(struct net_device *dev)
@@ -1147,7 +1151,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 +1236,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,
@@ -1247,19 +1251,14 @@ 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]);
+                               printk(KERN_DEBUG "  Rx data %pM %pM"
+                                      " %2.2x%2.2x %d.%d.%d.%d.\n",
+                                      &skb->data[0], &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);
-                       dev->last_rx = jiffies;
                        np->stats.rx_packets++;
                        np->stats.rx_bytes += pkt_len;
                }
@@ -1452,8 +1451,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)
@@ -1473,8 +1470,6 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
                return 0;
 
        case SIOCSMIIREG:               /* Write MII PHY register. */
-               if (!capable(CAP_NET_ADMIN))
-                       return -EPERM;
                spin_lock_irq(&np->lock);
                mdio_write(dev, data->phy_id & 0x1f, data->reg_num & 0x1f, data->val_in);
                spin_unlock_irq(&np->lock);
@@ -1523,7 +1518,7 @@ static int netdev_close(struct net_device *dev)
                        printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n",
                                   i, np->tx_ring[i].length,
                                   np->tx_ring[i].status, np->tx_ring[i].buffer1);
-               printk("\n"KERN_DEBUG "  Rx ring %8.8x:\n",
+               printk(KERN_DEBUG "  Rx ring %8.8x:\n",
                           (int)np->rx_ring);
                for (i = 0; i < RX_RING_SIZE; i++) {
                        printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n",
@@ -1564,7 +1559,7 @@ static void __devexit w840_remove1 (struct pci_dev *pdev)
  *     rtnl_lock, & netif_device_detach after the rtnl_unlock.
  * - get_stats:
  *     spin_lock_irq(np->lock), doesn't touch hw if not present
- * - hard_start_xmit:
+ * - start_xmit:
  *     synchronize_irq + netif_tx_disable;
  * - tx_timeout:
  *     netif_device_detach + netif_tx_disable;
@@ -1604,8 +1599,7 @@ static int w840_suspend (struct pci_dev *pdev, pm_message_t state)
 
                /* no more hardware accesses behind this line. */
 
-               BUG_ON(np->csr6);
-               if (ioread32(ioaddr + IntrEnable)) BUG();
+               BUG_ON(np->csr6 || ioread32(ioaddr + IntrEnable));
 
                /* pci_power_off(pdev, -1); */