make es3210.c allocating the net_device's dynamically using the new ei_alloc_dev() function, ethdev_init() is killed. compile tested. --- 1.8/drivers/net/es3210.c Thu Nov 21 23:06:11 2002 +++ edited/es3210.c Sun Jun 29 21:34:39 2003 @@ -239,13 +239,6 @@ printk("mem %#lx-%#lx\n", dev->mem_start, dev->mem_end-1); - /* Allocate dev->priv and fill in 8390 specific dev fields. */ - if (ethdev_init(dev)) { - printk (" unable to allocate memory for dev->priv.\n"); - retval = -ENOMEM; - goto out1; - } - #if ES_DEBUG & ES_D_PROBE if (inb(ioaddr + ES_CFG5)) printk("es3210: Warning - DMA channel enabled, but not used here.\n"); @@ -358,8 +351,7 @@ static int es_open(struct net_device *dev) { - ei_open(dev); - return 0; + return ei_open(dev); } static int es_close(struct net_device *dev) @@ -375,7 +367,7 @@ #ifdef MODULE #define MAX_ES_CARDS 4 /* Max number of ES3210 cards per module */ #define NAMELEN 8 /* # of chars for storing dev->name */ -static struct net_device dev_es3210[MAX_ES_CARDS]; +static struct net_device *dev_es3210[MAX_ES_CARDS]; static int io[MAX_ES_CARDS]; static int irq[MAX_ES_CARDS]; static int mem[MAX_ES_CARDS]; @@ -395,14 +387,24 @@ int this_dev, found = 0; for (this_dev = 0; this_dev < MAX_ES_CARDS; this_dev++) { - struct net_device *dev = &dev_es3210[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]; /* Currently ignored by driver */ dev->init = es_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 "es3210.c: No es3210 card found (i/o = 0x%x).\n", io[this_dev]); if (found != 0) { /* Got at least one. */ return 0; @@ -410,6 +412,7 @@ return -ENXIO; } found++; + dev_es3210[this_dev] = dev; } return 0; } @@ -420,13 +423,12 @@ int this_dev; for (this_dev = 0; this_dev < MAX_ES_CARDS; this_dev++) { - struct net_device *dev = &dev_es3210[this_dev]; - if (dev->priv != NULL) { - void *priv = dev->priv; + struct net_device *dev = dev_es3210[this_dev]; + if (dev) { free_irq(dev->irq, dev); release_region(dev->base_addr, ES_IO_EXTENT); 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