make lne390.c allocating the net_device's dynamically using the new ei_alloc_dev() function, ethdev_init() is killed. compile tested. --- 1.8/drivers/net/lne390.c Thu Nov 21 23:06:11 2002 +++ edited/lne390.c Sun Jun 29 22:10:09 2003 @@ -173,11 +173,6 @@ return -ENODEV; } #endif - /* Allocate dev->priv and fill in 8390 specific dev fields. */ - if (ethdev_init(dev)) { - printk ("lne390.c: unable to allocate memory for dev->priv!\n"); - return -ENOMEM; - } printk("lne390.c: LNE390%X in EISA slot %d, address", 0xa+revision, ioaddr/0x1000); for(i = 0; i < ETHER_ADDR_LEN; i++) @@ -372,7 +367,7 @@ #ifdef MODULE #define MAX_LNE_CARDS 4 /* Max number of LNE390 cards per module */ -static struct net_device dev_lne[MAX_LNE_CARDS]; +static struct net_device *dev_lne[MAX_LNE_CARDS]; static int io[MAX_LNE_CARDS]; static int irq[MAX_LNE_CARDS]; static int mem[MAX_LNE_CARDS]; @@ -391,14 +386,24 @@ int this_dev, found = 0; for (this_dev = 0; this_dev < MAX_LNE_CARDS; this_dev++) { - struct net_device *dev = &dev_lne[this_dev]; + struct net_device *dev; + + /* Default is to only install one card. */ + if (io[this_dev] == 0 && this_dev != 0) break; + + dev = ei_alloc_dev(); + if (!dev) { + /* free already found devices */ + cleanup_module(); + return -ENOMEM; + } + dev->irq = irq[this_dev]; dev->base_addr = io[this_dev]; dev->mem_start = mem[this_dev]; dev->init = lne390_probe; - /* Default is to only install one card. */ - if (io[this_dev] == 0 && this_dev != 0) break; if (register_netdev(dev) != 0) { + kfree(dev); printk(KERN_WARNING "lne390.c: No LNE390 card found (i/o = 0x%x).\n", io[this_dev]); if (found != 0) { /* Got at least one. */ return 0; @@ -406,6 +411,7 @@ return -ENXIO; } found++; + dev_lne[this_dev] = dev; } return 0; } @@ -415,15 +421,14 @@ int this_dev; for (this_dev = 0; this_dev < MAX_LNE_CARDS; this_dev++) { - struct net_device *dev = &dev_lne[this_dev]; - if (dev->priv != NULL) { - void *priv = dev->priv; + struct net_device *dev = dev_lne[this_dev]; + if (dev) { free_irq(dev->irq, dev); release_region(dev->base_addr, LNE390_IO_EXTENT); if (ei_status.reg0) iounmap((void *)dev->mem_start); unregister_netdev(dev); - kfree(priv); + kfree(dev); } } } - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html