Commit 4e956a78 authored by Alexander Viro's avatar Alexander Viro Committed by David S. Miller

[NET]: Move bmac.c away from init_etherdev().

parent a043bc4c
...@@ -1331,12 +1331,13 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus) ...@@ -1331,12 +1331,13 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
} }
} }
dev = init_etherdev(NULL, PRIV_BYTES); dev = alloc_etherdev(PRIV_BYTES);
if (!dev) { if (!dev) {
printk(KERN_ERR "init_etherdev failed, out of memory for BMAC %s\n", printk(KERN_ERR "alloc_etherdev failed, out of memory for BMAC %s\n",
bmac->full_name); bmac->full_name);
return; return;
} }
bp = (struct bmac_data *) dev->priv; bp = (struct bmac_data *) dev->priv;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
bp->node = bmac; bp->node = bmac;
...@@ -1344,21 +1345,22 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus) ...@@ -1344,21 +1345,22 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
if (!request_OF_resource(bmac, 0, " (bmac)")) { if (!request_OF_resource(bmac, 0, " (bmac)")) {
printk(KERN_ERR "BMAC: can't request IO resource !\n"); printk(KERN_ERR "BMAC: can't request IO resource !\n");
goto err_out; goto out1;
} }
if (!request_OF_resource(bmac, 1, " (bmac tx dma)")) { if (!request_OF_resource(bmac, 1, " (bmac tx dma)")) {
printk(KERN_ERR "BMAC: can't request TX DMA resource !\n"); printk(KERN_ERR "BMAC: can't request TX DMA resource !\n");
goto err_out; goto out2;
} }
if (!request_OF_resource(bmac, 2, " (bmac rx dma)")) { if (!request_OF_resource(bmac, 2, " (bmac rx dma)")) {
printk(KERN_ERR "BMAC: can't request RX DMA resource !\n"); printk(KERN_ERR "BMAC: can't request RX DMA resource !\n");
goto err_out; goto out3;
} }
dev->base_addr = (unsigned long) dev->base_addr = (unsigned long)
ioremap(bmac->addrs[0].address, bmac->addrs[0].size); ioremap(bmac->addrs[0].address, bmac->addrs[0].size);
if (!dev->base_addr) if (!dev->base_addr)
goto err_out; goto out4;
dev->irq = bmac->intrs[0].line; dev->irq = bmac->intrs[0].line;
bmac_enable_and_reset_chip(dev); bmac_enable_and_reset_chip(dev);
...@@ -1430,10 +1432,18 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus) ...@@ -1430,10 +1432,18 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
disable_irq(dev->irq); disable_irq(dev->irq);
pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0); pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0);
if (register_netdev(dev) != 0) {
printk(KERN_ERR "registration failed for BMAC %s\n",
bmac->full_name);
goto err_out_irq2;
}
bp->next_bmac = bmac_devs; bp->next_bmac = bmac_devs;
bmac_devs = dev; bmac_devs = dev;
return; return;
err_out_irq2:
free_irq(bmac->intrs[2].line, dev);
err_out_irq1: err_out_irq1:
free_irq(bmac->intrs[1].line, dev); free_irq(bmac->intrs[1].line, dev);
err_out_irq0: err_out_irq0:
...@@ -1444,14 +1454,14 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus) ...@@ -1444,14 +1454,14 @@ static void __init bmac_probe1(struct device_node *bmac, int is_bmac_plus)
iounmap((void *)bp->tx_dma); iounmap((void *)bp->tx_dma);
err_out_iounmap: err_out_iounmap:
iounmap((void *)dev->base_addr); iounmap((void *)dev->base_addr);
err_out: out4:
if (bp->node) {
release_OF_resource(bp->node, 0);
release_OF_resource(bp->node, 1);
release_OF_resource(bp->node, 2); release_OF_resource(bp->node, 2);
out3:
release_OF_resource(bp->node, 1);
out2:
release_OF_resource(bp->node, 0);
out1:
pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0); pmac_call_feature(PMAC_FTR_BMAC_ENABLE, bp->node, 0, 0);
}
unregister_netdev(dev);
kfree(dev); kfree(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