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

[netdrvr hydra] use alloc_etherdev

parent ed947ded
...@@ -89,15 +89,17 @@ static int __init hydra_init(unsigned long board) ...@@ -89,15 +89,17 @@ static int __init hydra_init(unsigned long board)
const char name[] = "NE2000"; const char name[] = "NE2000";
int start_page, stop_page; int start_page, stop_page;
int j; int j;
int err;
static u32 hydra_offsets[16] = { static u32 hydra_offsets[16] = {
0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e,
0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e,
}; };
dev = init_etherdev(NULL, 0); dev = alloc_etherdev(0);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev->priv = NULL;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
for(j = 0; j < ETHER_ADDR_LEN; j++) for(j = 0; j < ETHER_ADDR_LEN; j++)
...@@ -113,12 +115,16 @@ static int __init hydra_init(unsigned long board) ...@@ -113,12 +115,16 @@ static int __init hydra_init(unsigned long board)
/* Install the Interrupt handler */ /* Install the Interrupt handler */
if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, "Hydra Ethernet", if (request_irq(IRQ_AMIGA_PORTS, ei_interrupt, SA_SHIRQ, "Hydra Ethernet",
dev)) dev)) {
free_netdev(dev);
return -EAGAIN; return -EAGAIN;
}
/* Allocate dev->priv and fill in 8390 specific dev fields. */ /* Allocate dev->priv and fill in 8390 specific dev fields. */
if (ethdev_init(dev)) { if (ethdev_init(dev)) {
printk("Unable to get memory for dev->priv.\n"); printk("Unable to get memory for dev->priv.\n");
free_irq(IRQ_AMIGA_PORTS, dev);
free_netdev(dev);
return -ENOMEM; return -ENOMEM;
} }
...@@ -146,7 +152,14 @@ static int __init hydra_init(unsigned long board) ...@@ -146,7 +152,14 @@ static int __init hydra_init(unsigned long board)
root_hydra_dev = dev; root_hydra_dev = dev;
#endif #endif
NS8390_init(dev, 0); NS8390_init(dev, 0);
err = register_netdev(dev);
if (!err)
return 0; return 0;
free_irq(IRQ_AMIGA_PORTS, dev);
kfree(dev->priv);
free_netdev(dev);
return err;
} }
static int hydra_open(struct net_device *dev) static int hydra_open(struct net_device *dev)
......
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