Remove multiple KERN_ prefixes from printk formats
[safe/jmp/linux-2.6] / drivers / net / tulip / tulip_core.c
index f9d13fa..99a6364 100644 (file)
@@ -1,7 +1,5 @@
-/* tulip_core.c: A DEC 21x4x-family ethernet driver for Linux. */
+/*     tulip_core.c: A DEC 21x4x-family ethernet driver for Linux.
 
-/*
-       Maintained by Valerie Henson <val_henson@linux.intel.com>
        Copyright 2000,2001  The Linux Kernel Team
        Written/copyright 1994-2001 by Donald Becker.
 
@@ -9,9 +7,9 @@
        of the GNU General Public License, incorporated herein by reference.
 
        Please refer to Documentation/DocBook/tulip-user.{pdf,ps,html}
-       for more information on this driver, or visit the project
-       Web page at http://sourceforge.net/projects/tulip/
+       for more information on this driver.
 
+       Please submit bugs to http://bugzilla.kernel.org/ .
 */
 
 
@@ -257,6 +255,7 @@ const char tulip_media_cap[32] =
 
 static void tulip_tx_timeout(struct net_device *dev);
 static void tulip_init_ring(struct net_device *dev);
+static void tulip_free_ring(struct net_device *dev);
 static int tulip_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int tulip_open(struct net_device *dev);
 static int tulip_close(struct net_device *dev);
@@ -504,16 +503,21 @@ tulip_open(struct net_device *dev)
 {
        int retval;
 
-       if ((retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev)))
-               return retval;
-
        tulip_init_ring (dev);
 
+       retval = request_irq(dev->irq, &tulip_interrupt, IRQF_SHARED, dev->name, dev);
+       if (retval)
+               goto free_ring;
+
        tulip_up (dev);
 
        netif_start_queue (dev);
 
        return 0;
+
+free_ring:
+       tulip_free_ring (dev);
+       return retval;
 }
 
 
@@ -566,16 +570,18 @@ static void tulip_tx_timeout(struct net_device *dev)
                                   (unsigned int)tp->rx_ring[i].buffer2,
                                   buf[0], buf[1], buf[2]);
                        for (j = 0; buf[j] != 0xee && j < 1600; j++)
-                               if (j < 100) printk(" %2.2x", buf[j]);
-                       printk(" j=%d.\n", j);
+                               if (j < 100)
+                                       printk(KERN_CONT " %2.2x", buf[j]);
+                       printk(KERN_CONT " j=%d.\n", j);
                }
                printk(KERN_DEBUG "  Rx ring %8.8x: ", (int)tp->rx_ring);
                for (i = 0; i < RX_RING_SIZE; i++)
-                       printk(" %8.8x", (unsigned int)tp->rx_ring[i].status);
-               printk("\n" KERN_DEBUG "  Tx ring %8.8x: ", (int)tp->tx_ring);
+                       printk(KERN_CONT " %8.8x",
+                              (unsigned int)tp->rx_ring[i].status);
+               printk(KERN_DEBUG "  Tx ring %8.8x: ", (int)tp->tx_ring);
                for (i = 0; i < TX_RING_SIZE; i++)
-                       printk(" %8.8x", (unsigned int)tp->tx_ring[i].status);
-               printk("\n");
+                       printk(KERN_CONT " %8.8x", (unsigned int)tp->tx_ring[i].status);
+               printk(KERN_CONT "\n");
        }
 #endif
 
@@ -731,7 +737,7 @@ static void tulip_down (struct net_device *dev)
        void __iomem *ioaddr = tp->base_addr;
        unsigned long flags;
 
-       flush_scheduled_work();
+       cancel_work_sync(&tp->media_work);
 
 #ifdef CONFIG_TULIP_NAPI
        napi_disable(&tp->napi);
@@ -770,23 +776,11 @@ static void tulip_down (struct net_device *dev)
        tulip_set_power_state (tp, 0, 1);
 }
 
-
-static int tulip_close (struct net_device *dev)
+static void tulip_free_ring (struct net_device *dev)
 {
        struct tulip_private *tp = netdev_priv(dev);
-       void __iomem *ioaddr = tp->base_addr;
        int i;
 
-       netif_stop_queue (dev);
-
-       tulip_down (dev);
-
-       if (tulip_debug > 1)
-               printk (KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n",
-                       dev->name, ioread32 (ioaddr + CSR5));
-
-       free_irq (dev->irq, dev);
-
        /* Free all the skbuffs in the Rx queue. */
        for (i = 0; i < RX_RING_SIZE; i++) {
                struct sk_buff *skb = tp->rx_buffers[i].skb;
@@ -805,6 +799,7 @@ static int tulip_close (struct net_device *dev)
                        dev_kfree_skb (skb);
                }
        }
+
        for (i = 0; i < TX_RING_SIZE; i++) {
                struct sk_buff *skb = tp->tx_buffers[i].skb;
 
@@ -816,6 +811,24 @@ static int tulip_close (struct net_device *dev)
                tp->tx_buffers[i].skb = NULL;
                tp->tx_buffers[i].mapping = 0;
        }
+}
+
+static int tulip_close (struct net_device *dev)
+{
+       struct tulip_private *tp = netdev_priv(dev);
+       void __iomem *ioaddr = tp->base_addr;
+
+       netif_stop_queue (dev);
+
+       tulip_down (dev);
+
+       if (tulip_debug > 1)
+               printk (KERN_DEBUG "%s: Shutting down ethercard, status was %2.2x.\n",
+                       dev->name, ioread32 (ioaddr + CSR5));
+
+       free_irq (dev->irq, dev);
+
+       tulip_free_ring (dev);
 
        return 0;
 }
@@ -1052,13 +1065,11 @@ static void set_rx_mode(struct net_device *dev)
                                        filterbit = ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26;
                                filterbit &= 0x3f;
                                mc_filter[filterbit >> 5] |= 1 << (filterbit & 31);
-                               if (tulip_debug > 2) {
-                                       DECLARE_MAC_BUF(mac);
-                                       printk(KERN_INFO "%s: Added filter for %s"
+                               if (tulip_debug > 2)
+                                       printk(KERN_INFO "%s: Added filter for %pM"
                                               "  %8.8x bit %d.\n",
-                                              dev->name, print_mac(mac, mclist->dmi_addr),
+                                              dev->name, mclist->dmi_addr,
                                               ether_crc(ETH_ALEN, mclist->dmi_addr), filterbit);
-                               }
                        }
                        if (mc_filter[0] == tp->mc_filter[0]  &&
                                mc_filter[1] == tp->mc_filter[1])
@@ -1229,6 +1240,22 @@ static int tulip_uli_dm_quirk(struct pci_dev *pdev)
        return 0;
 }
 
+static const struct net_device_ops tulip_netdev_ops = {
+       .ndo_open               = tulip_open,
+       .ndo_start_xmit         = tulip_start_xmit,
+       .ndo_tx_timeout         = tulip_tx_timeout,
+       .ndo_stop               = tulip_close,
+       .ndo_get_stats          = tulip_get_stats,
+       .ndo_do_ioctl           = private_ioctl,
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller     = poll_tulip,
+#endif
+};
+
 static int __devinit tulip_init_one (struct pci_dev *pdev,
                                     const struct pci_device_id *ent)
 {
@@ -1252,7 +1279,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
        const char *chip_name = tulip_tbl[chip_idx].chip_name;
        unsigned int eeprom_missing = 0;
        unsigned int force_csr0 = 0;
-       DECLARE_MAC_BUF(mac);
 
 #ifndef MODULE
        static int did_version;         /* Already printed version info. */
@@ -1434,9 +1460,9 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
                for (i = 0; i < 3; i++) {
                        int value, boguscnt = 100000;
                        iowrite32(0x600 | i, ioaddr + 0x98);
-                       do
+                       do {
                                value = ioread32(ioaddr + CSR9);
-                       while (value < 0  && --boguscnt > 0);
+                       while (value < 0  && --boguscnt > 0);
                        put_unaligned_le16(value, ((__le16 *)dev->dev_addr) + i);
                        sum += value & 0xffff;
                }
@@ -1606,20 +1632,11 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
        }
 
        /* The Tulip-specific entries in the device structure. */
-       dev->open = tulip_open;
-       dev->hard_start_xmit = tulip_start_xmit;
-       dev->tx_timeout = tulip_tx_timeout;
+       dev->netdev_ops = &tulip_netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
 #ifdef CONFIG_TULIP_NAPI
        netif_napi_add(dev, &tp->napi, tulip_poll, 16);
 #endif
-       dev->stop = tulip_close;
-       dev->get_stats = tulip_get_stats;
-       dev->do_ioctl = private_ioctl;
-       dev->set_multicast_list = set_rx_mode;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = &poll_tulip;
-#endif
        SET_ETHTOOL_OPS(dev, &ops);
 
        if (register_netdev(dev))
@@ -1637,7 +1654,7 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
 
        if (eeprom_missing)
                printk(" EEPROM not present,");
-       printk(" %s", print_mac(mac, dev->dev_addr));
+       printk(" %pM", dev->dev_addr);
        printk(", IRQ %d.\n", irq);
 
         if (tp->chip_id == PNIC2)
@@ -1729,12 +1746,15 @@ static int tulip_suspend (struct pci_dev *pdev, pm_message_t state)
        if (!dev)
                return -EINVAL;
 
-       if (netif_running(dev))
-               tulip_down(dev);
+       if (!netif_running(dev))
+               goto save_state;
+
+       tulip_down(dev);
 
        netif_device_detach(dev);
        free_irq(dev->irq, dev);
 
+save_state:
        pci_save_state(pdev);
        pci_disable_device(pdev);
        pci_set_power_state(pdev, pci_choose_state(pdev, state));
@@ -1754,6 +1774,9 @@ static int tulip_resume(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
 
+       if (!netif_running(dev))
+               return 0;
+
        if ((retval = pci_enable_device(pdev))) {
                printk (KERN_ERR "tulip: pci_enable_device failed in resume\n");
                return retval;