Commit b60bdba3 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[netdrvr] convert most 8390 drivers to using alloc_ei_netdev()

parent 31dca45c
......@@ -145,12 +145,11 @@ static void cleanup_card(struct net_device *dev)
{
/* NB: el2_close() handles free_irq */
release_region(dev->base_addr, EL2_IO_EXTENT);
kfree(dev->priv);
}
struct net_device * __init el2_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -159,8 +158,6 @@ struct net_device * __init el2_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_el2_probe(dev);
if (err)
goto out;
......@@ -228,12 +225,6 @@ el2_probe1(struct net_device *dev, int ioaddr)
printk(version);
dev->base_addr = ioaddr;
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk ("3c503: unable to allocate memory for dev->priv.\n");
retval = -ENOMEM;
goto out1;
}
printk("%s: 3c503 at i/o base %#3x, node ", dev->name, ioaddr);
......@@ -699,10 +690,9 @@ init_module(void)
if (this_dev != 0) break; /* only autoprobe 1st one */
printk(KERN_NOTICE "3c503.c: Presently autoprobing (not recommended) for a single card.\n");
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_end = xcvr[this_dev]; /* low 4bits = xcvr sel. */
......
......@@ -128,12 +128,11 @@ static void cleanup_card(struct net_device *dev)
release_region(dev->base_addr, AC_IO_EXTENT);
if (ei_status.reg0)
iounmap((void *)dev->mem_start);
kfree(dev->priv);
}
struct net_device * __init ac3200_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -142,8 +141,6 @@ struct net_device * __init ac3200_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_ac3200_probe(dev);
if (err)
goto out;
......@@ -197,13 +194,6 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
}
#endif
/* 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 out;
}
/* Assign and allocate the interrupt now. */
if (dev->irq == 0) {
dev->irq = config2irq(inb(ioaddr + AC_CONFIG));
......@@ -251,7 +241,7 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
printk(KERN_CRIT "ac3200.c: or to an address above 0x%lx.\n", virt_to_phys(high_memory));
printk(KERN_CRIT "ac3200.c: Driver NOT installed.\n");
retval = -EINVAL;
goto out2;
goto out1;
}
dev->mem_start = (unsigned long)ioremap(dev->mem_start, AC_STOP_PG*0x100);
if (dev->mem_start == 0) {
......@@ -259,7 +249,7 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
printk(KERN_ERR "ac3200.c: Try using EISA SCU to set memory below 1MB.\n");
printk(KERN_ERR "ac3200.c: Driver NOT installed.\n");
retval = -EINVAL;
goto out2;
goto out1;
}
ei_status.reg0 = 1; /* Use as remap flag */
printk("ac3200.c: remapped %dkB card memory to virtual address %#lx\n",
......@@ -288,11 +278,8 @@ static int __init ac_probe1(int ioaddr, struct net_device *dev)
dev->stop = &ac_close_card;
NS8390_init(dev, 0);
return 0;
out2:
free_irq(dev->irq, dev);
out1:
kfree(dev->priv);
dev->priv = NULL;
free_irq(dev->irq, dev);
out:
release_region(ioaddr, AC_IO_EXTENT);
return retval;
......@@ -401,10 +388,9 @@ init_module(void)
for (this_dev = 0; this_dev < MAX_AC32_CARDS; this_dev++) {
if (io[this_dev] == 0 && this_dev != 0)
break;
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev]; /* Currently ignored by driver */
......
......@@ -138,10 +138,9 @@ struct net_device * __init apne_probe(int unit)
return ERR_PTR(-ENODEV);
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
return ERR_PTR(-ENOMEM);
dev->priv = NULL;
if (unit >= 0) {
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
......@@ -314,13 +313,6 @@ static int __init apne_probe1(struct net_device *dev, int ioaddr)
i = request_irq(IRQ_AMIGA_PORTS, apne_interrupt, SA_SHIRQ, dev->name, dev);
if (i) return i;
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk (" unable to get memory for dev->priv.\n");
free_irq(IRQ_AMIGA_PORTS, dev);
return -ENOMEM;
}
for(i = 0; i < ETHER_ADDR_LEN; i++) {
printk(" %2.2x", SA_prom[i]);
dev->dev_addr[i] = SA_prom[i];
......
......@@ -551,15 +551,12 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
etherh_banner();
dev = alloc_etherdev(sizeof(struct etherh_priv));
dev = alloc_ei_netdev();
if (!dev) {
ret = -ENOMEM;
goto out;
}
/*
* alloc_etherdev allocs and zeros dev->priv
*/
eh = dev->priv;
spin_lock_init(&eh->eidev.page_lock);
......@@ -622,21 +619,12 @@ etherh_probe(struct expansion_card *ec, const struct ecard_id *id)
goto free;
}
if (ethdev_init(dev)) {
ret = -ENODEV;
goto release;
}
/*
* If we're in the NIC slot, make sure the IRQ is enabled
*/
if (dev->irq == 11)
etherh_set_ctrl(eh, ETHERH_CP_IE);
/*
* Unfortunately, ethdev_init eventually calls
* ether_setup, which re-writes dev->flags.
*/
switch (ec->cid.product) {
case PROD_ANT_ETHERM:
dev_type = "ANT EtherM";
......
......@@ -140,15 +140,13 @@ static int __init do_e2100_probe(struct net_device *dev)
static void cleanup_card(struct net_device *dev)
{
void *priv = dev->priv;
/* NB: e21_close() handles free_irq */
release_region(dev->base_addr, E21_IO_EXTENT);
kfree(priv);
}
struct net_device * __init e2100_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -157,8 +155,6 @@ struct net_device * __init e2100_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_e2100_probe(dev);
if (err)
goto out;
......@@ -212,13 +208,6 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
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++)
......@@ -228,8 +217,6 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
}
if (i >= 8) {
printk(" unable to get IRQ %d.\n", dev->irq);
kfree(dev->priv);
dev->priv = NULL;
retval = -EAGAIN;
goto out;
}
......@@ -443,10 +430,9 @@ init_module(void)
if (this_dev != 0) break; /* only autoprobe 1st one */
printk(KERN_NOTICE "e2100.c: Presently autoprobing (not recommended) for a single card.\n");
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev];
......
......@@ -159,12 +159,11 @@ static void cleanup_card(struct net_device *dev)
{
free_irq(dev->irq, dev);
release_region(dev->base_addr, ES_IO_EXTENT);
kfree(dev->priv);
}
struct net_device * __init es_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -173,8 +172,6 @@ struct net_device * __init es_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_es_probe(dev);
if (err)
goto out;
......@@ -278,13 +275,6 @@ static int __init es_probe1(struct net_device *dev, int ioaddr)
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");
......@@ -437,10 +427,9 @@ init_module(void)
for (this_dev = 0; this_dev < MAX_ES_CARDS; this_dev++) {
if (io[this_dev] == 0 && this_dev != 0)
break;
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev];
......
......@@ -140,12 +140,11 @@ static void cleanup_card(struct net_device *dev)
{
/* NB: hpp_close() handles free_irq */
release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT);
kfree(dev->priv);
}
struct net_device * __init hp_plus_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -154,8 +153,6 @@ struct net_device * __init hp_plus_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_hpp_probe(dev);
if (err)
goto out;
......@@ -215,13 +212,6 @@ static int __init hpp_probe1(struct net_device *dev, int ioaddr)
printk(" ID %4.4x", inw(ioaddr + 12));
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk ("hp-plus.c: unable to allocate memory for dev->priv.\n");
retval = -ENOMEM;
goto out;
}
/* Read the IRQ line. */
outw(HW_Page, ioaddr + HP_PAGING);
{
......@@ -460,10 +450,9 @@ init_module(void)
if (this_dev != 0) break; /* only autoprobe 1st one */
printk(KERN_NOTICE "hp-plus.c: Presently autoprobing (not recommended) for a single card.\n");
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
if (do_hpp_probe(dev) == 0) {
......
......@@ -104,12 +104,11 @@ static void cleanup_card(struct net_device *dev)
{
free_irq(dev->irq, dev);
release_region(dev->base_addr - NIC_OFFSET, HP_IO_EXTENT);
kfree(dev->priv);
}
struct net_device * __init hp_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -118,8 +117,6 @@ struct net_device * __init hp_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_hp_probe(dev);
if (err)
goto out;
......@@ -167,13 +164,6 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
if (ei_debug && version_printed++ == 0)
printk(version);
/* 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;
}
printk("%s: %s (ID %02x) at %#3x,", dev->name, name, board_id, ioaddr);
for(i = 0; i < ETHER_ADDR_LEN; i++)
......@@ -202,14 +192,14 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
if (*irqp == 0) {
printk(" no free IRQ lines.\n");
retval = -EBUSY;
goto out1;
goto out;
}
} else {
if (dev->irq == 2)
dev->irq = 9;
if ((retval = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) {
printk (" unable to get IRQ %d.\n", dev->irq);
goto out1;
goto out;
}
}
......@@ -231,9 +221,6 @@ static int __init hp_probe1(struct net_device *dev, int ioaddr)
hp_init_card(dev);
return 0;
out1:
kfree(dev->priv);
dev->priv = NULL;
out:
release_region(ioaddr, HP_IO_EXTENT);
return retval;
......@@ -432,10 +419,9 @@ init_module(void)
if (this_dev != 0) break; /* only autoprobe 1st one */
printk(KERN_NOTICE "hp.c: Presently autoprobing (not recommended) for a single card.\n");
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
if (do_hp_probe(dev) == 0) {
......
......@@ -96,10 +96,9 @@ static int __init hydra_init(unsigned long board)
0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
};
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
return -ENOMEM;
dev->priv = NULL;
SET_MODULE_OWNER(dev);
for(j = 0; j < ETHER_ADDR_LEN; j++)
......@@ -120,14 +119,6 @@ static int __init hydra_init(unsigned long board)
return -EAGAIN;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk("Unable to get memory for dev->priv.\n");
free_irq(IRQ_AMIGA_PORTS, dev);
free_netdev(dev);
return -ENOMEM;
}
printk("%s: hydra at 0x%08lx, address %02x:%02x:%02x:%02x:%02x:%02x (hydra.c " HYDRA_VERSION ")\n", dev->name, ZTWO_PADDR(board),
dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2],
dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]);
......@@ -157,7 +148,6 @@ static int __init hydra_init(unsigned long board)
return 0;
free_irq(IRQ_AMIGA_PORTS, dev);
kfree(dev->priv);
free_netdev(dev);
return err;
}
......
......@@ -149,12 +149,11 @@ static void cleanup_card(struct net_device *dev)
release_region(dev->base_addr, LNE390_IO_EXTENT);
if (ei_status.reg0)
iounmap((void *)dev->mem_start);
kfree(dev->priv);
}
struct net_device * __init lne390_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -163,8 +162,6 @@ struct net_device * __init lne390_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_lne390_probe(dev);
if (err)
goto out;
......@@ -213,11 +210,6 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
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++)
......@@ -238,8 +230,6 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
if ((ret = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev))) {
printk (" unable to get IRQ %d.\n", dev->irq);
kfree(dev->priv);
dev->priv = NULL;
return ret;
}
......@@ -313,8 +303,6 @@ static int __init lne390_probe1(struct net_device *dev, int ioaddr)
return 0;
cleanup:
free_irq(dev->irq, dev);
kfree(dev->priv);
dev->priv = NULL;
return ret;
}
......@@ -434,10 +422,9 @@ int init_module(void)
for (this_dev = 0; this_dev < MAX_LNE_CARDS; this_dev++) {
if (io[this_dev] == 0 && this_dev != 0)
break;
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev];
......
......@@ -242,10 +242,9 @@ struct net_device * __init mac8390_probe(int unit)
if (!MACH_IS_MAC)
return ERR_PTR(-ENODEV);
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
return ERR_PTR(-ENOMEM);
dev->priv = NULL;
if (unit >= 0)
sprintf(dev->name, "eth%d", unit);
......@@ -371,12 +370,9 @@ struct net_device * __init mac8390_probe(int unit)
goto out;
err = register_netdev(dev);
if (err)
goto out1;
goto out;
return dev;
out1:
kfree(dev->priv);
dev->priv = NULL;
out:
free_netdev(dev);
return ERR_PTR(err);
......@@ -412,7 +408,6 @@ void cleanup_module(void)
struct net_device *dev = dev_mac890[i];
if (dev) {
unregister_netdev(dev);
kfree(dev->priv);
free_netdev(dev);
}
}
......@@ -444,12 +439,6 @@ static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * nd
int access_bitmode;
/* 8390 specific init for dev - allocates dev->priv */
if (ethdev_init(dev)) {
printk(KERN_ERR "%s: Unable to allocate memory for dev->priv!\n", dev->name);
return -ENOMEM;
}
/* Now fill in our stuff */
dev->open = &mac8390_open;
dev->stop = &mac8390_close;
......@@ -520,8 +509,6 @@ static int __init mac8390_initdev(struct net_device * dev, struct nubus_dev * nd
break;
default:
printk(KERN_ERR "Card type %s is unsupported, sorry\n", cardname[type]);
kfree(dev->priv);
dev->priv = NULL;
return -ENODEV;
}
......
......@@ -194,18 +194,16 @@ static int __init do_ne_probe(struct net_device *dev)
static void cleanup_card(struct net_device *dev)
{
void *priv = dev->priv;
struct pnp_dev *idev = (struct pnp_dev *)ei_status.priv;
if (idev)
pnp_device_detach(idev);
free_irq(dev->irq, dev);
release_region(dev->base_addr, NE_IO_EXTENT);
kfree(priv);
}
struct net_device * __init ne_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -214,8 +212,6 @@ struct net_device * __init ne_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_ne_probe(dev);
if (err)
goto out;
......@@ -464,20 +460,12 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
goto err_out;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev))
{
printk (" unable to get memory for dev->priv.\n");
ret = -ENOMEM;
goto err_out;
}
/* Snarf the interrupt now. There's no point in waiting since we cannot
share and the board will usually be enabled. */
ret = request_irq(dev->irq, ei_interrupt, 0, name, dev);
if (ret) {
printk (" unable to get IRQ %d (errno=%d).\n", dev->irq, ret);
goto err_out_kfree;
goto err_out;
}
dev->base_addr = ioaddr;
......@@ -511,9 +499,6 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
NS8390_init(dev, 0);
return 0;
err_out_kfree:
kfree(dev->priv);
dev->priv = NULL;
err_out:
release_region(ioaddr, NE_IO_EXTENT);
return ret;
......@@ -797,10 +782,9 @@ int init_module(void)
int this_dev, found = 0;
for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->mem_end = bad[this_dev];
dev->base_addr = io[this_dev];
......
......@@ -280,14 +280,13 @@ static void cleanup_card(struct net_device *dev)
{
mca_mark_as_unused(ei_status.priv);
mca_set_adapter_procfn( ei_status.priv, NULL, NULL);
kfree(dev->priv);
free_irq(dev->irq, dev);
release_region(dev->base_addr, NE_IO_EXTENT);
}
struct net_device * __init ne2_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -296,8 +295,6 @@ struct net_device * __init ne2_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_ne2_probe(dev);
if (err)
goto out;
......@@ -482,14 +479,6 @@ static int __init ne2_probe1(struct net_device *dev, int slot)
dev->base_addr = base_addr;
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk (" unable to get memory for dev->priv.\n");
free_irq(dev->irq, dev);
retval = -ENOMEM;
goto out;
}
for(i = 0; i < ETHER_ADDR_LEN; i++) {
printk(" %2.2x", SA_prom[i]);
dev->dev_addr[i] = SA_prom[i];
......@@ -797,10 +786,9 @@ int init_module(void)
int this_dev, found = 0;
for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->mem_end = bad[this_dev];
dev->base_addr = io[this_dev];
......
......@@ -189,7 +189,7 @@ static void cleanup_card(struct net_device *dev)
struct net_device * __init ne_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -198,8 +198,6 @@ struct net_device * __init ne_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_ne_probe(dev);
if (err)
goto out;
......@@ -500,14 +498,6 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
goto err_out;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev))
{
printk (" unable to get memory for dev->priv.\n");
ret = -ENOMEM;
goto err_out;
}
/* Snarf the interrupt now. There's no point in waiting since we cannot
share and the board will usually be enabled. */
ret = request_irq(dev->irq, ei_interrupt, 0, name, dev);
......@@ -849,10 +839,9 @@ int init_module(void)
int this_dev, found = 0;
for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->mem_end = bad[this_dev];
dev->base_addr = io[this_dev];
......
......@@ -111,12 +111,6 @@ static int __init ne3210_eisa_probe (struct device *device)
device->driver_data = dev;
ioaddr = edev->base_addr;
if (ethdev_init (dev)) {
printk ("ne3210.c: unable to allocate memory for dev->priv!\n");
retval = -ENOMEM;
goto out;
}
if (!request_region(ioaddr, NE3210_IO_EXTENT, dev->name)) {
retval = -EBUSY;
goto out;
......
......@@ -106,10 +106,9 @@ static int __init oaknet_init(void)
if (!ioaddr)
return -ENOMEM;
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
goto out_unmap;
dev->priv = NULL;
ret = -EBUSY;
if (!request_region(OAKNET_IO_BASE, OAKNET_IO_SIZE, name))
......@@ -152,14 +151,6 @@ static int __init oaknet_init(void)
dev->base_addr = ioaddr;
dev->irq = OAKNET_INT;
/* Allocate 8390-specific device-private area and fields. */
ret = -ENOMEM;
if (ethdev_init(dev)) {
printk(" unable to get memory for dev->priv.\n");
goto out_region;
}
/*
* Disable all chip interrupts for now and ACK all pending
* interrupts.
......@@ -174,7 +165,7 @@ static int __init oaknet_init(void)
if (request_irq(dev->irq, ei_interrupt, 0, name, dev)) {
printk("%s: unable to request interrupt %d.\n",
dev->name, dev->irq);
goto out_priv;
goto out_region;
}
/* Tell the world about what and where we've found. */
......@@ -212,8 +203,6 @@ static int __init oaknet_init(void)
out_irq;
free_irq(dev->irq, dev);
out_priv:
kfree(dev->priv);
out_region:
release_region(OAKNET_IO_BASE, OAKNET_IO_SIZE);
out_dev:
......@@ -660,20 +649,11 @@ oaknet_dma_error(struct net_device *dev, const char *name)
*/
static void __exit oaknet_cleanup_module (void)
{
if (oaknet_devs == NULL)
return;
if (oaknet_devs->priv != NULL) {
int ioaddr = oaknet_devs->base_addr;
void *priv = oaknet_devs->priv;
unregister_netdev(oaknet_dev);
free_irq(oaknet_devs->irq, oaknet_devs);
kfree(priv);
release_region(ioaddr, OAKNET_IO_SIZE);
iounmap(ioaddr);
}
/* Convert to loop once driver supports multiple devices. */
unregister_netdev(oaknet_dev);
free_irq(oaknet_devs->irq, oaknet_devs);
release_region(oaknet_devs->base_addr, OAKNET_IO_SIZE);
iounmap(ioaddr);
free_netdev(oaknet_devs);
}
......
......@@ -165,12 +165,11 @@ static void cleanup_card(struct net_device *dev)
pnp_device_detach(idev);
#endif
release_region(dev->base_addr - ULTRA_NIC_OFFSET, ULTRA_IO_EXTENT);
kfree(dev->priv);
}
struct net_device * __init ultra_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -179,8 +178,6 @@ struct net_device * __init ultra_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_ultra_probe(dev);
if (err)
goto out;
......@@ -267,13 +264,6 @@ static int __init ultra_probe1(struct net_device *dev, int ioaddr)
eeprom_irq = 1;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk (", no memory for dev->priv.\n");
retval = -ENOMEM;
goto out;
}
/* The 8390 isn't at the base address, so fake the offset */
dev->base_addr = ioaddr+ULTRA_NIC_OFFSET;
......@@ -565,10 +555,9 @@ init_module(void)
if (this_dev != 0) break; /* only autoprobe 1st one */
printk(KERN_NOTICE "smc-ultra.c: Presently autoprobing (not recommended) for a single card.\n");
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
if (do_ultra_probe(dev) == 0) {
......
......@@ -102,7 +102,6 @@ static void cleanup_card(struct net_device *dev)
int ioaddr = dev->base_addr - ULTRA32_NIC_OFFSET;
/* NB: ultra32_close_card() does free_irq */
release_region(ioaddr, ULTRA32_IO_EXTENT);
kfree(dev->priv);
}
/* Probe for the Ultra32. This looks like a 8013 with the station
......@@ -120,7 +119,7 @@ struct net_device * __init ultra32_probe(int unit)
if (!EISA_bus)
return ERR_PTR(-ENODEV);
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
return ERR_PTR(-ENOMEM);
......@@ -243,13 +242,6 @@ static int __init ultra32_probe1(struct net_device *dev, int ioaddr)
dev->irq = irq;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk (", no memory for dev->priv.\n");
retval = -ENOMEM;
goto out;
}
/* The 8390 isn't at the base address, so fake the offset */
dev->base_addr = ioaddr + ULTRA32_NIC_OFFSET;
......
......@@ -108,19 +108,10 @@ static int __init stnic_probe(void)
return -ENODEV;
/* New style probing API */
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER(dev);
dev->priv = NULL;
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init (dev))
{
printk (KERN_EMERG "Unable to get memory for dev->priv.\n");
free_netdev(dev);
return -ENOMEM;
}
#ifdef CONFIG_SH_STANDARD_BIOS
sh_bios_get_node_addr (stnic_eadr);
......@@ -139,7 +130,6 @@ static int __init stnic_probe(void)
err = request_irq (dev->irq, ei_interrupt, 0, dev->name, dev);
if (err) {
printk (KERN_EMERG " unable to get IRQ %d.\n", dev->irq);
kfree(dev->priv);
free_netdev(dev);
return err;
}
......@@ -165,7 +155,6 @@ static int __init stnic_probe(void)
err = register_netdev(dev);
if (err) {
free_irq(dev->irq, dev);
kfree(dev->priv);
free_netdev(dev);
return err;
}
......@@ -318,7 +307,6 @@ static void __exit stnic_cleanup(void)
{
unregister_netdev(stnic_dev);
free_irq(stnic_dev->irq, stnic_dev);
kfree(stnic_dev->priv);
free_netdev(stnic_dev);
}
......
......@@ -129,12 +129,11 @@ static void cleanup_card(struct net_device *dev)
{
free_irq(dev->irq, dev);
release_region(dev->base_addr - WD_NIC_OFFSET, WD_IO_EXTENT);
kfree(dev->priv);
}
struct net_device * __init wd_probe(int unit)
{
struct net_device *dev = alloc_etherdev(0);
struct net_device *dev = alloc_ei_netdev();
int err;
if (!dev)
......@@ -143,8 +142,6 @@ struct net_device * __init wd_probe(int unit)
sprintf(dev->name, "eth%d", unit);
netdev_boot_setup_check(dev);
dev->priv = NULL; /* until all 8390-based use alloc_etherdev() */
err = do_wd_probe(dev);
if (err)
goto out;
......@@ -301,19 +298,11 @@ static int __init wd_probe1(struct net_device *dev, int ioaddr)
} else if (dev->irq == 2) /* Fixup bogosity: IRQ2 is really IRQ9 */
dev->irq = 9;
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk (" unable to get memory for dev->priv.\n");
return -ENOMEM;
}
/* Snarf the interrupt now. There's no point in waiting since we cannot
share and the board will usually be enabled. */
i = request_irq(dev->irq, ei_interrupt, 0, dev->name, dev);
if (i) {
printk (" unable to get IRQ %d.\n", dev->irq);
kfree(dev->priv);
dev->priv = NULL;
return i;
}
......@@ -515,10 +504,9 @@ init_module(void)
if (this_dev != 0) break; /* only autoprobe 1st one */
printk(KERN_NOTICE "wd.c: Presently autoprobing (not recommended) for a single card.\n");
}
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
break;
dev->priv = NULL;
dev->irq = irq[this_dev];
dev->base_addr = io[this_dev];
dev->mem_start = mem[this_dev];
......
......@@ -103,10 +103,9 @@ static int __init zorro8390_probe(void)
continue;
board = z->resource.start;
ioaddr = board+cards[i].offset;
dev = alloc_etherdev(0);
dev = alloc_ei_netdev();
if (!dev)
return -ENOMEM;
dev->priv = NULL;
SET_MODULE_OWNER(dev);
if (!request_mem_region(ioaddr, NE_IO_EXTENT*2, dev->name)) {
free_netdev(dev);
......@@ -197,13 +196,6 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
i = request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, dev->name, dev);
if (i) return i;
/* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) {
printk("Unable to get memory for dev->priv.\n");
free_irq(IRQ_AMIGA_PORTS, dev);
return -ENOMEM;
}
for(i = 0; i < ETHER_ADDR_LEN; i++) {
#ifdef DEBUG
printk(" %2.2x", SA_prom[i]);
......@@ -236,10 +228,8 @@ static int __init zorro8390_init(struct net_device *dev, unsigned long board,
#endif
NS8390_init(dev, 0);
err = register_netdev(dev);
if (err) {
kfree(dev->priv);
if (err)
free_irq(IRQ_AMIGA_PORTS, dev);
}
return err;
}
......@@ -421,7 +411,6 @@ static void __exit zorro8390_cleanup(void)
unregister_netdev(dev);
free_irq(IRQ_AMIGA_PORTS, dev);
release_mem_region(ZTWO_PADDR(dev->base_addr), NE_IO_EXTENT*2);
kfree(dev->priv);
free_netdev(dev);
root_zorro8390_dev = next;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment