make e2100.c allocating the net_device's dynamically using the new ei_alloc_dev() function, ethdev_init() is killed. compile tested. --- 1.12/drivers/net/e2100.c Mon Feb 24 19:34:25 2003 +++ edited/e2100.c Sun Jun 29 21:33:56 2003 @@ -175,13 +175,6 @@ for (i = 0; i < 6; i++) printk(" %02X", station_addr[i]); - /* Allocate dev->priv and fill in 8390 specific dev fields. */ - if (ethdev_init(dev)) { - printk (" unable to get memory for dev->priv.\n"); - retval = -ENOMEM; - goto out; - } - if (dev->irq < 2) { int irqlist[] = {15,11,10,12,5,9,3,4}, i; for (i = 0; i < 8; i++) @@ -191,8 +184,6 @@ } if (i >= 8) { printk(" unable to get IRQ %d.\n", dev->irq); - kfree(dev->priv); - dev->priv = NULL; retval = -EAGAIN; goto out; } @@ -271,8 +262,7 @@ inb(ioaddr + E21_MEM_BASE); outb(0, ioaddr + E21_ASIC + ((dev->mem_start >> 17) & 7)); - ei_open(dev); - return 0; + return ei_open(dev); } static void @@ -376,7 +366,7 @@ #ifdef MODULE #define MAX_E21_CARDS 4 /* Max number of E21 cards per module */ -static struct net_device dev_e21[MAX_E21_CARDS]; +static struct net_device *dev_e21[MAX_E21_CARDS]; static int io[MAX_E21_CARDS]; static int irq[MAX_E21_CARDS]; static int mem[MAX_E21_CARDS]; @@ -401,17 +391,26 @@ int this_dev, found = 0; for (this_dev = 0; this_dev < MAX_E21_CARDS; this_dev++) { - struct net_device *dev = &dev_e21[this_dev]; + struct net_device *dev; + if (io[this_dev] == 0) { + if (this_dev != 0) break; /* only autoprobe 1st one */ + printk(KERN_NOTICE "e2100.c: Presently autoprobing (not recommended) for a single card.\n"); + } + + 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->mem_end = xcvr[this_dev]; /* low 4bits = xcvr sel. */ dev->init = e2100_probe; - if (io[this_dev] == 0) { - if (this_dev != 0) break; /* only autoprobe 1st one */ - printk(KERN_NOTICE "e2100.c: Presently autoprobing (not recommended) for a single card.\n"); - } if (register_netdev(dev) != 0) { + kfree(dev); printk(KERN_WARNING "e2100.c: No E2100 card found (i/o = 0x%x).\n", io[this_dev]); if (found != 0) { /* Got at least one. */ return 0; @@ -419,6 +418,7 @@ return -ENXIO; } found++; + dev_e21[this_dev] = dev; } return 0; } @@ -429,13 +429,12 @@ int this_dev; for (this_dev = 0; this_dev < MAX_E21_CARDS; this_dev++) { - struct net_device *dev = &dev_e21[this_dev]; - if (dev->priv != NULL) { - void *priv = dev->priv; + struct net_device *dev = dev_e21[this_dev]; + if (dev) { /* NB: e21_close() handles free_irq */ release_region(dev->base_addr, E21_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