fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / e2100.c
index 51c9fa2..c62d9c6 100644 (file)
@@ -110,7 +110,7 @@ static void e21_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
 
 static int e21_close(struct net_device *dev);
 
-\f
+
 /*  Probe for the E2100 series ethercards.  These cards have an 8390 at the
        base address and the station address at both offset 0x10 and 0x18.  I read
        the station address from offset 0x18 to avoid the dataport of NE2000
@@ -140,13 +140,6 @@ static int  __init do_e2100_probe(struct net_device *dev)
        return -ENODEV;
 }
 
-static void cleanup_card(struct net_device *dev)
-{
-       /* NB: e21_close() handles free_irq */
-       iounmap(ei_status.mem);
-       release_region(dev->base_addr, E21_IO_EXTENT);
-}
-
 #ifndef MODULE
 struct net_device * __init e2100_probe(int unit)
 {
@@ -162,12 +155,7 @@ struct net_device * __init e2100_probe(int unit)
        err = do_e2100_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);
@@ -286,6 +274,9 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
 #endif
        NS8390_init(dev, 0);
 
+       retval = register_netdev(dev);
+       if (retval)
+               goto out;
        return 0;
 out:
        release_region(ioaddr, E21_IO_EXTENT);
@@ -412,7 +403,7 @@ e21_close(struct net_device *dev)
        return 0;
 }
 
-\f
+
 #ifdef MODULE
 #define MAX_E21_CARDS  4       /* Max number of E21 cards per module */
 static struct net_device *dev_e21[MAX_E21_CARDS];
@@ -434,8 +425,8 @@ 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
-init_module(void)
+
+int __init init_module(void)
 {
        struct net_device *dev;
        int this_dev, found = 0;
@@ -453,11 +444,8 @@ init_module(void)
                dev->mem_start = mem[this_dev];
                dev->mem_end = xcvr[this_dev];  /* low 4bits = xcvr sel. */
                if (do_e2100_probe(dev) == 0) {
-                       if (register_netdev(dev) == 0) {
-                               dev_e21[found++] = dev;
-                               continue;
-                       }
-                       cleanup_card(dev);
+                       dev_e21[found++] = dev;
+                       continue;
                }
                free_netdev(dev);
                printk(KERN_WARNING "e2100.c: No E2100 card found (i/o = 0x%x).\n", io[this_dev]);
@@ -468,7 +456,14 @@ init_module(void)
        return -ENXIO;
 }
 
-void
+static void cleanup_card(struct net_device *dev)
+{
+       /* NB: e21_close() handles free_irq */
+       iounmap(ei_status.mem);
+       release_region(dev->base_addr, E21_IO_EXTENT);
+}
+
+void __exit
 cleanup_module(void)
 {
        int this_dev;