fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / ac3200.c
index 24fba36..c01f87f 100644 (file)
@@ -45,7 +45,7 @@ static const char version[] =
 #define AC_NIC_BASE    0x00
 #define AC_SA_PROM     0x16                    /* The station address PROM. */
 #define AC_ADDR0       0x00                    /* Prefix station address values. */
-#define AC_ADDR1       0x40                    
+#define AC_ADDR1       0x40
 #define AC_ADDR2       0x90
 #define AC_ID_PORT     0xC80
 #define AC_EISA_ID     0x0110d305
@@ -89,7 +89,7 @@ static void ac_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr,
                                        int ring_page);
 
 static int ac_close_card(struct net_device *dev);
-\f
+
 
 /*     Probe for the AC3200.
 
@@ -123,14 +123,6 @@ static int __init do_ac3200_probe(struct net_device *dev)
        return -ENODEV;
 }
 
-static void cleanup_card(struct net_device *dev)
-{
-       /* Someday free_irq may be in ac_close_card() */
-       free_irq(dev->irq, dev);
-       release_region(dev->base_addr, AC_IO_EXTENT);
-       iounmap(ei_status.mem);
-}
-
 #ifndef MODULE
 struct net_device * __init ac3200_probe(int unit)
 {
@@ -146,12 +138,7 @@ struct net_device * __init ac3200_probe(int unit)
        err = do_ac3200_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);
@@ -230,7 +217,7 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
        dev->if_port = inb(ioaddr + AC_CONFIG) >> 6;
        dev->mem_start = config2mem(inb(ioaddr + AC_CONFIG));
 
-       printk("%s: AC3200 at %#3x with %dkB memory at physical address %#lx.\n", 
+       printk("%s: AC3200 at %#3x with %dkB memory at physical address %#lx.\n",
                        dev->name, ioaddr, AC_STOP_PG/4, dev->mem_start);
 
        /*
@@ -273,7 +260,14 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
        dev->poll_controller = ei_poll;
 #endif
        NS8390_init(dev, 0);
+
+       retval = register_netdev(dev);
+       if (retval)
+               goto out2;
        return 0;
+out2:
+       if (ei_status.reg0)
+               iounmap(ei_status.mem);
 out1:
        free_irq(dev->irq, dev);
 out:
@@ -376,8 +370,7 @@ MODULE_PARM_DESC(mem, "Memory base address(es)");
 MODULE_DESCRIPTION("Ansel AC3200 EISA ethernet driver");
 MODULE_LICENSE("GPL");
 
-int
-init_module(void)
+int __init init_module(void)
 {
        struct net_device *dev;
        int this_dev, found = 0;
@@ -392,11 +385,8 @@ init_module(void)
                dev->base_addr = io[this_dev];
                dev->mem_start = mem[this_dev];         /* Currently ignored by driver */
                if (do_ac3200_probe(dev) == 0) {
-                       if (register_netdev(dev) == 0) {
-                               dev_ac32[found++] = dev;
-                               continue;
-                       }
-                       cleanup_card(dev);
+                       dev_ac32[found++] = dev;
+                       continue;
                }
                free_netdev(dev);
                printk(KERN_WARNING "ac3200.c: No ac3200 card found (i/o = 0x%x).\n", io[this_dev]);
@@ -407,7 +397,15 @@ init_module(void)
        return -ENXIO;
 }
 
-void
+static void cleanup_card(struct net_device *dev)
+{
+       /* Someday free_irq may be in ac_close_card() */
+       free_irq(dev->irq, dev);
+       release_region(dev->base_addr, AC_IO_EXTENT);
+       iounmap(ei_status.mem);
+}
+
+void __exit
 cleanup_module(void)
 {
        int this_dev;