Add changes from the Linux-2.6 tree.
[linux-2.6.git] / drivers / net / 3c503.c
index 29dfd47..7e34c4f 100644 (file)
@@ -79,9 +79,9 @@ static void el2_block_input(struct net_device *dev, int count, struct sk_buff *s
                           int ring_offset);
 static void el2_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
                         int ring_page);
-static struct ethtool_ops netdev_ethtool_ops;
+static const struct ethtool_ops netdev_ethtool_ops;
+
 
-\f
 /* This routine probes for a memory-mapped 3c503 board by looking for
    the "location register" at the end of the jumpered boot PROM space.
    This works even if a PROM isn't there.
@@ -96,7 +96,7 @@ static int __init do_el2_probe(struct net_device *dev)
     int irq = dev->irq;
 
     SET_MODULE_OWNER(dev);
-    
+
     if (base_addr > 0x1ff)     /* Check a single specified location. */
        return el2_probe1(dev, base_addr);
     else if (base_addr != 0)           /* Don't probe at all. */
@@ -127,7 +127,7 @@ static int __init do_el2_probe(struct net_device *dev)
 
 /*  Try all of the locations that aren't obviously empty.  This touches
     a lot of locations, and is much riskier than the code above. */
-static int __init 
+static int __init
 el2_pio_probe(struct net_device *dev)
 {
     int i;
@@ -148,14 +148,6 @@ el2_pio_probe(struct net_device *dev)
     return -ENODEV;
 }
 
-static void cleanup_card(struct net_device *dev)
-{
-       /* NB: el2_close() handles free_irq */
-       release_region(dev->base_addr, EL2_IO_EXTENT);
-       if (ei_status.mem)
-               iounmap(ei_status.mem);
-}
-
 #ifndef MODULE
 struct net_device * __init el2_probe(int unit)
 {
@@ -171,12 +163,7 @@ struct net_device * __init el2_probe(int unit)
        err = do_el2_probe(dev);
        if (err)
                goto out;
-       err = register_netdev(dev);
-       if (err)
-               goto out1;
        return dev;
-out1:
-       cleanup_card(dev);
 out:
        free_netdev(dev);
        return ERR_PTR(err);
@@ -186,7 +173,7 @@ out:
 /* Probe for the Etherlink II card at I/O port base IOADDR,
    returning non-zero on success.  If found, set the station
    address and memory parameters in DEVICE. */
-static int __init 
+static int __init
 el2_probe1(struct net_device *dev, int ioaddr)
 {
     int i, iobase_reg, membase_reg, saved_406, wordlength, retval;
@@ -356,6 +343,10 @@ el2_probe1(struct net_device *dev, int ioaddr)
     dev->poll_controller = ei_poll;
 #endif
 
+    retval = register_netdev(dev);
+    if (retval)
+       goto out1;
+
     if (dev->mem_start)
        printk("%s: %s - %dkB RAM, 8kB shared mem window at %#6lx-%#6lx.\n",
                dev->name, ei_status.name, (wordlength+1)<<3,
@@ -376,7 +367,7 @@ out:
     release_region(ioaddr, EL2_IO_EXTENT);
     return retval;
 }
-\f
+
 static int
 el2_open(struct net_device *dev)
 {
@@ -394,7 +385,7 @@ el2_open(struct net_device *dev)
                outb_p(0x04 << ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR);
                outb_p(0x00, E33G_IDCFR);
                if (*irqp == probe_irq_off(cookie)      /* It's a good IRQ line! */
-                   && ((retval = request_irq(dev->irq = *irqp, 
+                   && ((retval = request_irq(dev->irq = *irqp,
                    ei_interrupt, 0, dev->name, dev)) == 0))
                    break;
            }
@@ -675,7 +666,7 @@ static void netdev_get_drvinfo(struct net_device *dev,
        sprintf(info->bus_info, "ISA 0x%lx", dev->base_addr);
 }
 
-static struct ethtool_ops netdev_ethtool_ops = {
+static const struct ethtool_ops netdev_ethtool_ops = {
        .get_drvinfo            = netdev_get_drvinfo,
 };
 
@@ -697,7 +688,7 @@ MODULE_LICENSE("GPL");
 
 /* This is set up so that only a single autoprobe takes place per call.
 ISA device autoprobes on a running machine are not recommended. */
-int
+int __init
 init_module(void)
 {
        struct net_device *dev;
@@ -715,11 +706,8 @@ init_module(void)
                dev->base_addr = io[this_dev];
                dev->mem_end = xcvr[this_dev];  /* low 4bits = xcvr sel. */
                if (do_el2_probe(dev) == 0) {
-                       if (register_netdev(dev) == 0) {
-                               dev_el2[found++] = dev;
-                               continue;
-                       }
-                       cleanup_card(dev);
+                       dev_el2[found++] = dev;
+                       continue;
                }
                free_netdev(dev);
                printk(KERN_WARNING "3c503.c: No 3c503 card found (i/o = 0x%x).\n", io[this_dev]);
@@ -730,7 +718,15 @@ init_module(void)
        return -ENXIO;
 }
 
-void
+static void cleanup_card(struct net_device *dev)
+{
+       /* NB: el2_close() handles free_irq */
+       release_region(dev->base_addr, EL2_IO_EXTENT);
+       if (ei_status.mem)
+               iounmap(ei_status.mem);
+}
+
+void __exit
 cleanup_module(void)
 {
        int this_dev;