Commit 5fb5d5ae authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[netdrvr] A bunch of gratitious ->init() killed; several leaks plugged.

Drivers updated: eth1394, baycom_epp, lp486e, plip, 3c359,
olympic, tms380tr.
parent 5a084b66
...@@ -375,8 +375,8 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu) ...@@ -375,8 +375,8 @@ static void ether1394_reset_priv (struct net_device *dev, int set_mtu)
} }
} }
/* This function is called by register_netdev */ /* This function is called right before register_netdev */
static int ether1394_init_dev (struct net_device *dev) static void ether1394_init_dev (struct net_device *dev)
{ {
/* Our functions */ /* Our functions */
dev->open = ether1394_open; dev->open = ether1394_open;
...@@ -403,8 +403,6 @@ static int ether1394_init_dev (struct net_device *dev) ...@@ -403,8 +403,6 @@ static int ether1394_init_dev (struct net_device *dev)
dev->type = ARPHRD_IEEE1394; dev->type = ARPHRD_IEEE1394;
ether1394_reset_priv (dev, 1); ether1394_reset_priv (dev, 1);
return 0;
} }
/* /*
...@@ -437,8 +435,6 @@ static void ether1394_add_host (struct hpsb_host *host) ...@@ -437,8 +435,6 @@ static void ether1394_add_host (struct hpsb_host *host)
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
dev->init = ether1394_init_dev;
priv = (struct eth1394_priv *)dev->priv; priv = (struct eth1394_priv *)dev->priv;
spin_lock_init(&priv->lock); spin_lock_init(&priv->lock);
...@@ -459,6 +455,8 @@ static void ether1394_add_host (struct hpsb_host *host) ...@@ -459,6 +455,8 @@ static void ether1394_add_host (struct hpsb_host *host)
goto out; goto out;
} }
ether1394_init_dev(dev);
if (register_netdev (dev)) { if (register_netdev (dev)) {
ETH1394_PRINT (KERN_ERR, dev->name, "Error registering network driver\n"); ETH1394_PRINT (KERN_ERR, dev->name, "Error registering network driver\n");
goto out; goto out;
...@@ -483,7 +481,7 @@ static void ether1394_add_host (struct hpsb_host *host) ...@@ -483,7 +481,7 @@ static void ether1394_add_host (struct hpsb_host *host)
out: out:
if (dev != NULL) if (dev != NULL)
kfree(dev); free_netdev(dev);
if (hi) if (hi)
hpsb_destroy_hostinfo(&eth1394_highlevel, host); hpsb_destroy_hostinfo(&eth1394_highlevel, host);
......
...@@ -1275,7 +1275,7 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) ...@@ -1275,7 +1275,7 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
* If dev->base_addr == 2, allocate space for the device and return success * If dev->base_addr == 2, allocate space for the device and return success
* (detachable devices only). * (detachable devices only).
*/ */
static int baycom_probe(struct net_device *dev) static void baycom_probe(struct net_device *dev)
{ {
static char ax25_bcast[AX25_ADDR_LEN] = { static char ax25_bcast[AX25_ADDR_LEN] = {
'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1 'Q' << 1, 'S' << 1, 'T' << 1, ' ' << 1, ' ' << 1, ' ' << 1, '0' << 1
...@@ -1288,9 +1288,6 @@ static int baycom_probe(struct net_device *dev) ...@@ -1288,9 +1288,6 @@ static int baycom_probe(struct net_device *dev)
}; };
struct baycom_state *bc; struct baycom_state *bc;
if (!dev)
return -ENXIO;
baycom_paranoia_check(dev, "baycom_probe", -ENXIO);
/* /*
* not a real probe! only initialize data structures * not a real probe! only initialize data structures
*/ */
...@@ -1332,8 +1329,6 @@ static int baycom_probe(struct net_device *dev) ...@@ -1332,8 +1329,6 @@ static int baycom_probe(struct net_device *dev)
/* New style flags */ /* New style flags */
dev->flags = 0; dev->flags = 0;
return 0;
} }
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
...@@ -1368,7 +1363,7 @@ static void __init baycom_epp_dev_setup(struct net_device *dev) ...@@ -1368,7 +1363,7 @@ static void __init baycom_epp_dev_setup(struct net_device *dev)
/* /*
* initialize part of the device struct * initialize part of the device struct
*/ */
dev->init = baycom_probe; baycom_probe(dev);
} }
static int __init init_baycomepp(void) static int __init init_baycomepp(void)
......
...@@ -1314,18 +1314,23 @@ static int io = IOADDR; ...@@ -1314,18 +1314,23 @@ static int io = IOADDR;
static int irq = IRQ; static int irq = IRQ;
static int __init lp486e_init_module(void) { static int __init lp486e_init_module(void) {
struct net_device *dev; int err;
struct net_device *dev = alloc_etherdev(sizeof(struct i596_private));
dev = alloc_etherdev(sizeof(struct i596_private));
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
dev->irq = irq; dev->irq = irq;
dev->base_addr = io; dev->base_addr = io;
dev->init = lp486e_probe; err = lp486e_probe(dev);
if (register_netdev(dev) != 0) { if (err) {
free_netdev(dev);
return err;
}
err = register_netdev(dev);
if (err) {
release_region(dev->base_addr, LP486E_TOTAL_SIZE);
free_netdev(dev); free_netdev(dev);
return -EIO; return err;
} }
dev_lp486e = dev; dev_lp486e = dev;
full_duplex = 0; full_duplex = 0;
......
...@@ -277,19 +277,11 @@ inline static unsigned char read_status (struct net_device *dev) ...@@ -277,19 +277,11 @@ inline static unsigned char read_status (struct net_device *dev)
then calls us here. then calls us here.
*/ */
static int static void
plip_init_netdev(struct net_device *dev) plip_init_netdev(struct net_device *dev)
{ {
struct net_local *nl = dev->priv; struct net_local *nl = dev->priv;
printk(KERN_INFO "%s", version);
if (dev->irq != -1)
printk(KERN_INFO "%s: Parallel port at %#3lx, using IRQ %d.\n",
dev->name, dev->base_addr, dev->irq);
else
printk(KERN_INFO "%s: Parallel port at %#3lx, not using IRQ.\n",
dev->name, dev->base_addr);
/* Then, override parts of it */ /* Then, override parts of it */
dev->hard_start_xmit = plip_tx_packet; dev->hard_start_xmit = plip_tx_packet;
dev->open = plip_open; dev->open = plip_open;
...@@ -323,8 +315,6 @@ plip_init_netdev(struct net_device *dev) ...@@ -323,8 +315,6 @@ plip_init_netdev(struct net_device *dev)
INIT_WORK(&nl->timer, (void (*)(void *))plip_timer_bh, dev); INIT_WORK(&nl->timer, (void (*)(void *))plip_timer_bh, dev);
spin_lock_init(&nl->lock); spin_lock_init(&nl->lock);
return 0;
} }
/* Bottom half handler for the delayed request. /* Bottom half handler for the delayed request.
...@@ -1289,7 +1279,6 @@ static void plip_attach (struct parport *port) ...@@ -1289,7 +1279,6 @@ static void plip_attach (struct parport *port)
} }
strcpy(dev->name, name); strcpy(dev->name, name);
dev->init = plip_init_netdev;
SET_MODULE_OWNER(dev); SET_MODULE_OWNER(dev);
dev->irq = port->irq; dev->irq = port->irq;
...@@ -1310,10 +1299,22 @@ static void plip_attach (struct parport *port) ...@@ -1310,10 +1299,22 @@ static void plip_attach (struct parport *port)
return; return;
} }
plip_init_netdev(dev);
if (register_netdev(dev)) { if (register_netdev(dev)) {
printk(KERN_ERR "%s: network register failed\n", name); printk(KERN_ERR "%s: network register failed\n", name);
goto err_parport_unregister; goto err_parport_unregister;
} }
printk(KERN_INFO "%s", version);
if (dev->irq != -1)
printk(KERN_INFO "%s: Parallel port at %#3lx, "
"using IRQ %d.\n",
dev->name, dev->base_addr, dev->irq);
else
printk(KERN_INFO "%s: Parallel port at %#3lx, "
"not using IRQ.\n",
dev->name, dev->base_addr);
dev_plip[unit++] = dev; dev_plip[unit++] = dev;
} }
return; return;
......
...@@ -314,7 +314,6 @@ int __devinit xl_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -314,7 +314,6 @@ int __devinit xl_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dev->irq=pdev->irq; dev->irq=pdev->irq;
dev->base_addr=pci_resource_start(pdev,0) ; dev->base_addr=pci_resource_start(pdev,0) ;
dev->init=NULL ; /* Must be null with new api, otherwise get called twice */
xl_priv->xl_card_name = pci_name(pdev); xl_priv->xl_card_name = pci_name(pdev);
xl_priv->xl_mmio=ioremap(pci_resource_start(pdev,1), XL_IO_SPACE); xl_priv->xl_mmio=ioremap(pci_resource_start(pdev,1), XL_IO_SPACE);
xl_priv->pdev = pdev ; xl_priv->pdev = pdev ;
......
...@@ -228,7 +228,6 @@ static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device ...@@ -228,7 +228,6 @@ static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device
#endif #endif
dev->irq=pdev->irq; dev->irq=pdev->irq;
dev->base_addr=pci_resource_start(pdev, 0); dev->base_addr=pci_resource_start(pdev, 0);
dev->init=NULL; /* Must be NULL otherwise we get called twice */
olympic_priv->olympic_card_name = pci_name(pdev); olympic_priv->olympic_card_name = pci_name(pdev);
olympic_priv->pdev = pdev; olympic_priv->pdev = pdev;
olympic_priv->olympic_mmio = ioremap(pci_resource_start(pdev,1),256); olympic_priv->olympic_mmio = ioremap(pci_resource_start(pdev,1),256);
......
...@@ -147,7 +147,6 @@ static void tms380tr_hardware_send_packet(struct net_device *dev, ...@@ -147,7 +147,6 @@ static void tms380tr_hardware_send_packet(struct net_device *dev,
struct net_local* tp); struct net_local* tp);
/* "I" */ /* "I" */
static int tms380tr_init_adapter(struct net_device *dev); static int tms380tr_init_adapter(struct net_device *dev);
static int tms380tr_init_card(struct net_device *dev);
static void tms380tr_init_ipb(struct net_local *tp); static void tms380tr_init_ipb(struct net_local *tp);
static void tms380tr_init_net_local(struct net_device *dev); static void tms380tr_init_net_local(struct net_device *dev);
static void tms380tr_init_opb(struct net_device *dev); static void tms380tr_init_opb(struct net_device *dev);
...@@ -232,15 +231,6 @@ static int madgemc_sifprobe(struct net_device *dev) ...@@ -232,15 +231,6 @@ static int madgemc_sifprobe(struct net_device *dev)
} }
#endif #endif
/* Dummy function */
static int tms380tr_init_card(struct net_device *dev)
{
if(tms380tr_debug > 3)
printk(KERN_DEBUG "%s: tms380tr_init_card\n", dev->name);
return (0);
}
/* /*
* Open/initialize the board. This is called sometime after * Open/initialize the board. This is called sometime after
* booting when the 'ifconfig' program is run. * booting when the 'ifconfig' program is run.
...@@ -2386,7 +2376,6 @@ int tmsdev_init(struct net_device *dev, unsigned long dmalimit, ...@@ -2386,7 +2376,6 @@ int tmsdev_init(struct net_device *dev, unsigned long dmalimit,
} }
/* These can be overridden by the card driver if needed */ /* These can be overridden by the card driver if needed */
dev->init = tms380tr_init_card;
dev->open = tms380tr_open; dev->open = tms380tr_open;
dev->stop = tms380tr_close; dev->stop = tms380tr_close;
dev->do_ioctl = NULL; dev->do_ioctl = NULL;
......
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