Commit 6122979e authored by Dave Jones's avatar Dave Jones Committed by Jeff Garzik

[PATCH] au1000 init cleanups.

Not sure if I incorporated all your feedback on this one last time.
Bug me if not...
parent e31549be
...@@ -675,37 +675,24 @@ au1000_probe1(struct net_device *dev, long ioaddr, int irq, int port_num) ...@@ -675,37 +675,24 @@ au1000_probe1(struct net_device *dev, long ioaddr, int irq, int port_num)
char *pmac, *argptr; char *pmac, *argptr;
char ethaddr[6]; char ethaddr[6];
if (!request_region(ioaddr, MAC_IOSIZE, "Au1000 ENET")) { if (!request_region(ioaddr, MAC_IOSIZE, "Au1000 ENET"))
return -ENODEV; return -ENODEV;
}
if (version_printed++ == 0) printk(version); if (version_printed++ == 0) printk(version);
if (!dev) { if (!dev)
dev = init_etherdev(0, sizeof(struct au1000_private)); dev = init_etherdev(NULL, sizeof(struct au1000_private));
}
if (!dev) { if (!dev) {
printk (KERN_ERR "au1000 eth: init_etherdev failed\n"); printk (KERN_ERR "au1000 eth: init_etherdev failed\n");
release_region(ioaddr, MAC_IOSIZE);
return -ENODEV; return -ENODEV;
} }
printk("%s: Au1xxx ethernet found at 0x%lx, irq %d\n", printk("%s: Au1xxx ethernet found at 0x%lx, irq %d\n",
dev->name, ioaddr, irq); dev->name, ioaddr, irq);
/* Initialize our private structure */
if (dev->priv == NULL) {
aup = (struct au1000_private *)
kmalloc(sizeof(*aup), GFP_KERNEL);
if (aup == NULL) {
retval = -ENOMEM;
goto free_region;
}
dev->priv = aup;
}
aup = dev->priv; aup = dev->priv;
memset(aup, 0, sizeof(*aup));
/* Allocate the data buffers */ /* Allocate the data buffers */
aup->vaddr = (u32)dma_alloc(MAX_BUF_SIZE * aup->vaddr = (u32)dma_alloc(MAX_BUF_SIZE *
...@@ -834,8 +821,6 @@ au1000_probe1(struct net_device *dev, long ioaddr, int irq, int port_num) ...@@ -834,8 +821,6 @@ au1000_probe1(struct net_device *dev, long ioaddr, int irq, int port_num)
if (aup->vaddr) if (aup->vaddr)
dma_free((void *)aup->vaddr, dma_free((void *)aup->vaddr,
MAX_BUF_SIZE * (NUM_TX_BUFFS+NUM_RX_BUFFS)); MAX_BUF_SIZE * (NUM_TX_BUFFS+NUM_RX_BUFFS));
if (dev->priv != NULL)
kfree(dev->priv);
printk(KERN_ERR "%s: au1000_probe1 failed. Returns %d\n", printk(KERN_ERR "%s: au1000_probe1 failed. Returns %d\n",
dev->name, retval); dev->name, retval);
kfree(dev); kfree(dev);
...@@ -1003,15 +988,15 @@ static int au1000_close(struct net_device *dev) ...@@ -1003,15 +988,15 @@ static int au1000_close(struct net_device *dev)
spin_lock_irqsave(&aup->lock, flags); spin_lock_irqsave(&aup->lock, flags);
/* stop the device */ /* stop the device */
if (netif_device_present(dev)) { if (netif_device_present(dev))
netif_stop_queue(dev); netif_stop_queue(dev);
}
/* disable the interrupt */ /* disable the interrupt */
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
spin_unlock_irqrestore(&aup->lock, flags); spin_unlock_irqrestore(&aup->lock, flags);
reset_mac(dev); reset_mac(dev);
kfree(dev);
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
return 0; return 0;
} }
......
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