fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / net / hp.c
index 00358a9..635b13c 100644 (file)
@@ -75,7 +75,7 @@ static void hp_init_card(struct net_device *dev);
 /* My default is IRQ5               0  1  2  3  4  5  6  7  8  9 10 11 */
 static char irqmap[16] __initdata= { 0, 0, 4, 6, 8,10, 0,14, 0, 4, 2,12,0,0,0,0};
 
-\f
+
 /*     Probe for an HP LAN adaptor.
        Also initialize the card and fill in STATION_ADDR with the station
        address. */
@@ -102,12 +102,6 @@ static int __init do_hp_probe(struct net_device *dev)
        return -ENODEV;
 }
 
-static void cleanup_card(struct net_device *dev)
-{
-       free_irq(dev->irq, dev);
-       release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT);
-}
-
 #ifndef MODULE
 struct net_device * __init hp_probe(int unit)
 {
@@ -123,12 +117,7 @@ struct net_device * __init hp_probe(int unit)
        err = do_hp_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);
@@ -227,7 +216,12 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
        ei_status.block_output = &hp_block_output;
        hp_init_card(dev);
 
+       retval = register_netdev(dev);
+       if (retval)
+               goto out1;
        return 0;
+out1:
+       free_irq(dev->irq, dev);
 out:
        release_region(ioaddr, HP_IO_EXTENT);
        return retval;
@@ -390,7 +384,7 @@ hp_block_output(struct net_device *dev, int count,
 }
 
 /* This function resets the ethercard if something screws up. */
-static void
+static void __init
 hp_init_card(struct net_device *dev)
 {
        int irq = dev->irq;
@@ -406,8 +400,8 @@ static struct net_device *dev_hp[MAX_HP_CARDS];
 static int io[MAX_HP_CARDS];
 static int irq[MAX_HP_CARDS];
 
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_HP_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_HP_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
 MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
 MODULE_DESCRIPTION("HP PC-LAN ISA ethernet driver");
@@ -415,7 +409,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;
@@ -432,11 +426,8 @@ init_module(void)
                dev->irq = irq[this_dev];
                dev->base_addr = io[this_dev];
                if (do_hp_probe(dev) == 0) {
-                       if (register_netdev(dev) == 0) {
-                               dev_hp[found++] = dev;
-                               continue;
-                       }
-                       cleanup_card(dev);
+                       dev_hp[found++] = dev;
+                       continue;
                }
                free_netdev(dev);
                printk(KERN_WARNING "hp.c: No HP card found (i/o = 0x%x).\n", io[this_dev]);
@@ -447,7 +438,13 @@ init_module(void)
        return -ENXIO;
 }
 
-void
+static void cleanup_card(struct net_device *dev)
+{
+       free_irq(dev->irq, dev);
+       release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT);
+}
+
+void __exit
 cleanup_module(void)
 {
        int this_dev;