net: spread __net_init, __net_exit
[safe/jmp/linux-2.6] / drivers / net / lne390.c
index 179a97c..41cbaae 100644 (file)
@@ -53,9 +53,6 @@ static const char *version =
 
 static int lne390_probe1(struct net_device *dev, int ioaddr);
 
-static int lne390_open(struct net_device *dev);
-static int lne390_close(struct net_device *dev);
-
 static void lne390_reset_8390(struct net_device *dev);
 
 static void lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_page);
@@ -111,8 +108,6 @@ static int __init do_lne390_probe(struct net_device *dev)
        int mem_start = dev->mem_start;
        int ret;
 
-       SET_MODULE_OWNER(dev);
-
        if (ioaddr > 0x1ff) {           /* Check a single specified location. */
                if (!request_region(ioaddr, LNE390_IO_EXTENT, DRV_NAME))
                        return -EBUSY;
@@ -145,13 +140,6 @@ static int __init do_lne390_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, LNE390_IO_EXTENT);
-       iounmap(ei_status.mem);
-}
-
 #ifndef MODULE
 struct net_device * __init lne390_probe(int unit)
 {
@@ -167,12 +155,7 @@ struct net_device * __init lne390_probe(int unit)
        err = do_lne390_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);
@@ -200,7 +183,7 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
        }
 
        revision = (eisa_id >> 24) & 0x01;      /* 0 = rev A, 1 rev B */
-       
+
 #if 0
 /*     Check the Mylex vendor ID as well. Not really required. */
        if (inb(ioaddr + LNE390_SA_PROM + 0) != LNE390_ADDR0
@@ -214,10 +197,12 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
        }
 #endif
 
-       printk("lne390.c: LNE390%X in EISA slot %d, address", 0xa+revision, ioaddr/0x1000);
        for(i = 0; i < ETHER_ADDR_LEN; i++)
-               printk(" %02x", (dev->dev_addr[i] = inb(ioaddr + LNE390_SA_PROM + i)));
-       printk(".\nlne390.c: ");
+               dev->dev_addr[i] = inb(ioaddr + LNE390_SA_PROM + i);
+       printk("lne390.c: LNE390%X in EISA slot %d, address %pM.\n",
+              0xa+revision, ioaddr/0x1000, dev->dev_addr);
+
+       printk("lne390.c: ");
 
        /* Snarf the interrupt now. CFG file has them all listed as `edge' with share=NO */
        if (dev->irq == 0) {
@@ -290,13 +275,16 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
        ei_status.block_output = &lne390_block_output;
        ei_status.get_8390_hdr = &lne390_get_8390_hdr;
 
-       dev->open = &lne390_open;
-       dev->stop = &lne390_close;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = ei_poll;
-#endif
+       dev->netdev_ops = &ei_netdev_ops;
        NS8390_init(dev, 0);
+
+       ret = register_netdev(dev);
+       if (ret)
+               goto unmap;
        return 0;
+unmap:
+       if (ei_status.reg0)
+               iounmap(ei_status.mem);
 cleanup:
        free_irq(dev->irq, dev);
        return ret;
@@ -346,7 +334,7 @@ lne390_get_8390_hdr(struct net_device *dev, struct e8390_pkt_hdr *hdr, int ring_
        hdr->count = (hdr->count + 3) & ~3;     /* Round up allocation. */
 }
 
-/*     
+/*
  *     Block input and output are easy on shared memory ethercards, the only
  *     complication is when the ring buffer wraps. The count will already
  *     be rounded up to a doubleword value via lne390_get_8390_hdr() above.
@@ -379,21 +367,6 @@ static void lne390_block_output(struct net_device *dev, int count,
        memcpy_toio(shmem, buf, count);
 }
 
-static int lne390_open(struct net_device *dev)
-{
-       ei_open(dev);
-       return 0;
-}
-
-static int lne390_close(struct net_device *dev)
-{
-
-       if (ei_debug > 1)
-               printk("%s: Shutting down ethercard.\n", dev->name);
-
-       ei_close(dev);
-       return 0;
-}
 
 #ifdef MODULE
 #define MAX_LNE_CARDS  4       /* Max number of LNE390 cards per module */
@@ -411,7 +384,7 @@ MODULE_PARM_DESC(mem, "memory base address(es)");
 MODULE_DESCRIPTION("Mylex LNE390A/B EISA Ethernet driver");
 MODULE_LICENSE("GPL");
 
-int init_module(void)
+int __init init_module(void)
 {
        struct net_device *dev;
        int this_dev, found = 0;
@@ -426,11 +399,8 @@ int init_module(void)
                dev->base_addr = io[this_dev];
                dev->mem_start = mem[this_dev];
                if (do_lne390_probe(dev) == 0) {
-                       if (register_netdev(dev) == 0) {
-                               dev_lne[found++] = dev;
-                               continue;
-                       }
-                       cleanup_card(dev);
+                       dev_lne[found++] = dev;
+                       continue;
                }
                free_netdev(dev);
                printk(KERN_WARNING "lne390.c: No LNE390 card found (i/o = 0x%x).\n", io[this_dev]);
@@ -441,7 +411,14 @@ int init_module(void)
        return -ENXIO;
 }
 
-void cleanup_module(void)
+static void cleanup_card(struct net_device *dev)
+{
+       free_irq(dev->irq, dev);
+       release_region(dev->base_addr, LNE390_IO_EXTENT);
+       iounmap(ei_status.mem);
+}
+
+void __exit cleanup_module(void)
 {
        int this_dev;