sky2: fix sky2_link_down copy/paste comment error
[safe/jmp/linux-2.6] / drivers / net / 3c509.c
index fbb3719..3b00a4e 100644 (file)
@@ -191,7 +191,7 @@ static void el3_common_remove(struct net_device *dev);
 static ushort id_read_eeprom(int index);
 static ushort read_eeprom(int ioaddr, int index);
 static int el3_open(struct net_device *dev);
-static int el3_start_xmit(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t el3_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t el3_interrupt(int irq, void *dev_id);
 static void update_stats(struct net_device *dev);
 static struct net_device_stats *el3_get_stats(struct net_device *dev);
@@ -257,7 +257,7 @@ static int el3_isa_id_sequence(__be16 *phys_addr)
                            && !memcmp(phys_addr, el3_devs[i]->dev_addr,
                                       ETH_ALEN)) {
                                if (el3_debug > 3)
-                                       printk(KERN_DEBUG "3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
+                                       pr_debug("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
                                                phys_addr[0] & 0xff, phys_addr[0] >> 8,
                                                phys_addr[1] & 0xff, phys_addr[1] >> 8,
                                                phys_addr[2] & 0xff, phys_addr[2] >> 8);
@@ -480,9 +480,13 @@ static int pnp_registered;
 
 #ifdef CONFIG_EISA
 static struct eisa_device_id el3_eisa_ids[] = {
+               { "TCM5090" },
+               { "TCM5091" },
                { "TCM5092" },
                { "TCM5093" },
+               { "TCM5094" },
                { "TCM5095" },
+               { "TCM5098" },
                { "" }
 };
 MODULE_DEVICE_TABLE(eisa, el3_eisa_ids);
@@ -574,19 +578,18 @@ static int __devinit el3_common_init(struct net_device *dev)
 
        err = register_netdev(dev);
        if (err) {
-               printk(KERN_ERR "Failed to register 3c5x9 at %#3.3lx, IRQ %d.\n",
+               pr_err("Failed to register 3c5x9 at %#3.3lx, IRQ %d.\n",
                        dev->base_addr, dev->irq);
                release_region(dev->base_addr, EL3_IO_EXTENT);
                return err;
        }
 
-       printk(KERN_INFO "%s: 3c5x9 found at %#3.3lx, %s port, "
-              "address %pM, IRQ %d.\n",
+       pr_info("%s: 3c5x9 found at %#3.3lx, %s port, address %pM, IRQ %d.\n",
               dev->name, dev->base_addr, if_names[(dev->if_port & 0x03)],
               dev->dev_addr, dev->irq);
 
        if (el3_debug > 0)
-               printk(KERN_INFO "%s", version);
+               pr_info("%s", version);
        return 0;
 
 }
@@ -625,8 +628,8 @@ static int __init el3_mca_probe(struct device *device)
        irq = pos5 & 0x0f;
 
 
-       printk(KERN_INFO "3c529: found %s at slot %d\n",
-                  el3_mca_adapter_names[mdev->index], slot + 1);
+       pr_info("3c529: found %s at slot %d\n",
+               el3_mca_adapter_names[mdev->index], slot + 1);
 
        /* claim the slot */
        strncpy(mdev->name, el3_mca_adapter_names[mdev->index],
@@ -638,7 +641,7 @@ static int __init el3_mca_probe(struct device *device)
        irq = mca_device_transform_irq(mdev, irq);
        ioaddr = mca_device_transform_ioport(mdev, ioaddr);
        if (el3_debug > 2) {
-                       printk(KERN_DEBUG "3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
+               pr_debug("3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
        }
        EL3WINDOW(0);
        for (i = 0; i < 3; i++)
@@ -653,11 +656,11 @@ static int __init el3_mca_probe(struct device *device)
        netdev_boot_setup_check(dev);
 
        el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA);
-       device->driver_data = dev;
+       dev_set_drvdata(device, dev);
        err = el3_common_init(dev);
 
        if (err) {
-               device->driver_data = NULL;
+               dev_set_drvdata(device, NULL);
                free_netdev(dev);
                return -ENOMEM;
        }
@@ -721,12 +724,12 @@ static int __init el3_eisa_probe (struct device *device)
 
 /* This remove works for all device types.
  *
- * The net dev must be stored in the driver_data field */
+ * The net dev must be stored in the driver data field */
 static int __devexit el3_device_remove (struct device *device)
 {
        struct net_device *dev;
 
-       dev  = device->driver_data;
+       dev = dev_get_drvdata(device);
 
        el3_common_remove (dev);
        return 0;
@@ -761,7 +764,7 @@ static ushort id_read_eeprom(int index)
                word = (word << 1) + (inb(id_port) & 0x01);
 
        if (el3_debug > 3)
-               printk(KERN_DEBUG "  3c509 EEPROM word %d %#4.4x.\n", index, word);
+               pr_debug("  3c509 EEPROM word %d %#4.4x.\n", index, word);
 
        return word;
 }
@@ -783,13 +786,13 @@ el3_open(struct net_device *dev)
 
        EL3WINDOW(0);
        if (el3_debug > 3)
-               printk(KERN_DEBUG "%s: Opening, IRQ %d   status@%x %4.4x.\n", dev->name,
+               pr_debug("%s: Opening, IRQ %d    status@%x %4.4x.\n", dev->name,
                           dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS));
 
        el3_up(dev);
 
        if (el3_debug > 3)
-               printk(KERN_DEBUG "%s: Opened 3c509  IRQ %d  status %4.4x.\n",
+               pr_debug("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
                           dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
 
        return 0;
@@ -801,8 +804,7 @@ el3_tx_timeout (struct net_device *dev)
        int ioaddr = dev->base_addr;
 
        /* Transmitter timeout, serious problems. */
-       printk(KERN_WARNING "%s: transmit timed out, Tx_status %2.2x status %4.4x "
-                  "Tx FIFO room %d.\n",
+       pr_warning("%s: transmit timed out, Tx_status %2.2x status %4.4x Tx FIFO room %d.\n",
                   dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
                   inw(ioaddr + TX_FREE));
        dev->stats.tx_errors++;
@@ -814,7 +816,7 @@ el3_tx_timeout (struct net_device *dev)
 }
 
 
-static int
+static netdev_tx_t
 el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct el3_private *lp = netdev_priv(dev);
@@ -826,7 +828,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
        dev->stats.tx_bytes += skb->len;
 
        if (el3_debug > 4) {
-               printk(KERN_DEBUG "%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
+               pr_debug("%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
                           dev->name, skb->len, inw(ioaddr + EL3_STATUS));
        }
 #if 0
@@ -835,7 +837,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
                ushort status = inw(ioaddr + EL3_STATUS);
                if (status & 0x0001             /* IRQ line active, missed one. */
                        && inw(ioaddr + EL3_STATUS) & 1) {                      /* Make sure. */
-                       printk(KERN_DEBUG "%s: Missed interrupt, status then %04x now %04x"
+                       pr_debug("%s: Missed interrupt, status then %04x now %04x"
                                   "  Tx %2.2x Rx %4.4x.\n", dev->name, status,
                                   inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS),
                                   inw(ioaddr + RX_STATUS));
@@ -890,7 +892,7 @@ el3_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        outb(0x00, ioaddr + TX_STATUS); /* Pop the status stack. */
                }
        }
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /* The EL3 interrupt handler. */
@@ -909,7 +911,7 @@ el3_interrupt(int irq, void *dev_id)
 
        if (el3_debug > 4) {
                status = inw(ioaddr + EL3_STATUS);
-               printk(KERN_DEBUG "%s: interrupt, status %4.4x.\n", dev->name, status);
+               pr_debug("%s: interrupt, status %4.4x.\n", dev->name, status);
        }
 
        while ((status = inw(ioaddr + EL3_STATUS)) &
@@ -920,7 +922,7 @@ el3_interrupt(int irq, void *dev_id)
 
                if (status & TxAvailable) {
                        if (el3_debug > 5)
-                               printk(KERN_DEBUG "     TX room bit was handled.\n");
+                               pr_debug("      TX room bit was handled.\n");
                        /* There's room in the FIFO for a full-sized packet. */
                        outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
                        netif_wake_queue (dev);
@@ -958,7 +960,7 @@ el3_interrupt(int irq, void *dev_id)
                }
 
                if (--i < 0) {
-                       printk(KERN_ERR "%s: Infinite loop in interrupt, status %4.4x.\n",
+                       pr_err("%s: Infinite loop in interrupt, status %4.4x.\n",
                                   dev->name, status);
                        /* Clear all interrupts. */
                        outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -969,7 +971,7 @@ el3_interrupt(int irq, void *dev_id)
        }
 
        if (el3_debug > 4) {
-               printk(KERN_DEBUG "%s: exiting interrupt, status %4.4x.\n", dev->name,
+               pr_debug("%s: exiting interrupt, status %4.4x.\n", dev->name,
                           inw(ioaddr + EL3_STATUS));
        }
        spin_unlock(&lp->lock);
@@ -1017,7 +1019,7 @@ static void update_stats(struct net_device *dev)
        int ioaddr = dev->base_addr;
 
        if (el3_debug > 5)
-               printk("   Updating the statistics.\n");
+               pr_debug("   Updating the statistics.\n");
        /* Turn off statistics updates while reading. */
        outw(StatsDisable, ioaddr + EL3_CMD);
        /* Switch to the stats window, and read everything. */
@@ -1047,7 +1049,7 @@ el3_rx(struct net_device *dev)
        short rx_status;
 
        if (el3_debug > 5)
-               printk("   In rx_packet(), status %4.4x, rx_status %4.4x.\n",
+               pr_debug("   In rx_packet(), status %4.4x, rx_status %4.4x.\n",
                           inw(ioaddr+EL3_STATUS), inw(ioaddr+RX_STATUS));
        while ((rx_status = inw(ioaddr + RX_STATUS)) > 0) {
                if (rx_status & 0x4000) { /* Error, update stats. */
@@ -1069,7 +1071,7 @@ el3_rx(struct net_device *dev)
 
                        skb = dev_alloc_skb(pkt_len+5);
                        if (el3_debug > 4)
-                               printk("Receiving packet size %d status %4.4x.\n",
+                               pr_debug("Receiving packet size %d status %4.4x.\n",
                                           pkt_len, rx_status);
                        if (skb != NULL) {
                                skb_reserve(skb, 2);     /* Align IP on 16 byte */
@@ -1088,12 +1090,12 @@ el3_rx(struct net_device *dev)
                        outw(RxDiscard, ioaddr + EL3_CMD);
                        dev->stats.rx_dropped++;
                        if (el3_debug)
-                               printk("%s: Couldn't allocate a sk_buff of size %d.\n",
+                               pr_debug("%s: Couldn't allocate a sk_buff of size %d.\n",
                                           dev->name, pkt_len);
                }
                inw(ioaddr + EL3_STATUS);                               /* Delay. */
                while (inw(ioaddr + EL3_STATUS) & 0x1000)
-                       printk(KERN_DEBUG "     Waiting for 3c509 to discard packet, status %x.\n",
+                       pr_debug("      Waiting for 3c509 to discard packet, status %x.\n",
                                   inw(ioaddr + EL3_STATUS) );
        }
 
@@ -1114,7 +1116,7 @@ set_multicast_list(struct net_device *dev)
                static int old;
                if (old != dev->mc_count) {
                        old = dev->mc_count;
-                       printk("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
+                       pr_debug("%s: Setting Rx mode to %d addresses.\n", dev->name, dev->mc_count);
                }
        }
        spin_lock_irqsave(&lp->lock, flags);
@@ -1137,7 +1139,7 @@ el3_close(struct net_device *dev)
        struct el3_private *lp = netdev_priv(dev);
 
        if (el3_debug > 2)
-               printk("%s: Shutting down ethercard.\n", dev->name);
+               pr_debug("%s: Shutting down ethercard.\n", dev->name);
 
        el3_down(dev);
 
@@ -1384,30 +1386,30 @@ el3_up(struct net_device *dev)
                EL3WINDOW(4);
                net_diag = inw(ioaddr + WN4_NETDIAG);
                net_diag = (net_diag | FD_ENABLE); /* temporarily assume full-duplex will be set */
-               printk("%s: ", dev->name);
+               pr_info("%s: ", dev->name);
                switch (dev->if_port & 0x0c) {
                        case 12:
                                /* force full-duplex mode if 3c5x9b */
                                if (sw_info & 0x000f) {
-                                       printk("Forcing 3c5x9b full-duplex mode");
+                                       pr_cont("Forcing 3c5x9b full-duplex mode");
                                        break;
                                }
                        case 8:
                                /* set full-duplex mode based on eeprom config setting */
                                if ((sw_info & 0x000f) && (sw_info & 0x8000)) {
-                                       printk("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
+                                       pr_cont("Setting 3c5x9b full-duplex mode (from EEPROM configuration bit)");
                                        break;
                                }
                        default:
                                /* xcvr=(0 || 4) OR user has an old 3c5x9 non "B" model */
-                               printk("Setting 3c5x9/3c5x9B half-duplex mode");
+                               pr_cont("Setting 3c5x9/3c5x9B half-duplex mode");
                                net_diag = (net_diag & ~FD_ENABLE); /* disable full duplex */
                }
 
                outw(net_diag, ioaddr + WN4_NETDIAG);
-               printk(" if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info);
+               pr_cont(" if_port: %d, sw_info: %4.4x\n", dev->if_port, sw_info);
                if (el3_debug > 3)
-                       printk("%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
+                       pr_debug("%s: 3c5x9 net diag word is now: %4.4x.\n", dev->name, net_diag);
                /* Enable link beat and jabber check. */
                outw(inw(ioaddr + WN4_MEDIA) | MEDIA_TP, ioaddr + WN4_MEDIA);
        }
@@ -1451,7 +1453,7 @@ el3_suspend(struct device *pdev, pm_message_t state)
        struct el3_private *lp;
        int ioaddr;
 
-       dev = pdev->driver_data;
+       dev = dev_get_drvdata(pdev);
        lp = netdev_priv(dev);
        ioaddr = dev->base_addr;
 
@@ -1475,7 +1477,7 @@ el3_resume(struct device *pdev)
        struct el3_private *lp;
        int ioaddr;
 
-       dev = pdev->driver_data;
+       dev = dev_get_drvdata(pdev);
        lp = netdev_priv(dev);
        ioaddr = dev->base_addr;
 
@@ -1535,7 +1537,7 @@ static int __init el3_init_module(void)
        }
        if (id_port >= 0x200) {
                id_port = 0;
-               printk(KERN_ERR "No I/O port available for 3c509 activation.\n");
+               pr_err("No I/O port available for 3c509 activation.\n");
        } else {
                ret = isa_register_driver(&el3_isa_driver, EL3_MAX_CARDS);
                if (!ret)