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

[netdrvr stnic] use alloc_etherdev

parent 074821d5
......@@ -98,26 +98,27 @@ STNIC_WRITE (int reg, byte val)
STNIC_DELAY ();
}
int __init stnic_probe(void)
static int __init stnic_probe(void)
{
struct net_device *dev;
int i;
int i, err;
/* If we are not running on a SolutionEngine, give up now */
if (! MACH_SE)
return -ENODEV;
/* New style probing API */
dev = init_etherdev (NULL, 0);
dev = alloc_etherdev(0);
if (!dev)
return -ENOMEM;
SET_MODULE_OWNER(dev);
stnic_dev = dev;
dev->probe = 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;
}
......@@ -135,13 +136,12 @@ int __init stnic_probe(void)
/* 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) {
err = request_irq (dev->irq, ei_interrupt, 0, dev->name, dev);
if (err) {
printk (KERN_EMERG " unable to get IRQ %d.\n", dev->irq);
unregister_netdev(dev);
kfree(dev->priv);
kfree(dev);
return i;
free_netdev(dev);
return err;
}
ei_status.name = dev->name;
......@@ -162,6 +162,15 @@ int __init stnic_probe(void)
stnic_init (dev);
err = register_netdev(dev);
if (err) {
free_irq(dev->irq, dev);
kfree(dev->priv);
free_netdev(dev);
return err;
}
stnic_dev = dev;
printk (KERN_INFO "NS ST-NIC 83902A\n");
return 0;
......@@ -305,15 +314,14 @@ stnic_init (struct net_device *dev)
return;
}
/* Hardware interrupt handler. */
extern void ei_interrupt (int irq, void *dev_id, struct pt_regs *regs);
void
do_stnic_intr (int irq, void *dev_id, struct pt_regs *regs)
static void __exit stnic_cleanup(void)
{
ei_interrupt (0, stnic_dev, regs);
unregister_netdev(stnic_dev);
free_irq(stnic_dev->irq, stnic_dev);
kfree(stnic_dev->priv);
free_netdev(stnic_dev);
}
module_init(stnic_probe);
/* No cleanup routine. */
module_exit(stnic_cleanup);
MODULE_LICENSE("GPL");
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