[PATCH 2.5 18/25] 8390-cleanup for oaknet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



make oaknet.c allocating the net_device's dynamically using the new
ei_alloc_dev() function, init_ethdev() and ethdev_init() are killed.
compile tested.


--- 1.3/drivers/net/oaknet.c	Tue Feb  5 08:52:40 2002
+++ edited/oaknet.c	Sun Jun 29 21:15:54 2003
@@ -149,7 +149,7 @@
 	 * our own device structure.
 	 */
 
-	dev = init_etherdev(NULL, 0);
+	dev = ei_alloc_dev();
 	ret = -ENOMEM;
 	if (!dev)
 		goto out_region;
@@ -164,14 +164,6 @@
 	dev->base_addr = ioaddr;
 	dev->irq = OAKNET_INT;
 
-	/* Allocate 8390-specific device-private area and fields. */
-
-	ret = -ENOMEM;
-	if (ethdev_init(dev)) {
-		printk(" unable to get memory for dev->priv.\n");
-		goto out_dev;
-	}
-
 	/*
 	 * Disable all chip interrupts for now and ACK all pending
 	 * interrupts.
@@ -186,7 +178,7 @@
 	if (request_irq(dev->irq, ei_interrupt, 0, name, dev)) {
 		printk("%s: unable to request interrupt %d.\n",
 		       dev->name, dev->irq);
-		goto out_priv;
+		goto out_free;
 	}
 
 	/* Tell the world about what and where we've found. */
@@ -216,11 +208,13 @@
 
 	NS8390_init(dev, FALSE);
 
+	ret = register_netdev(dev);
+	if (ret)
+		goto out_free;
+	
 	return (0);
-out_priv:
-	kfree(dev->priv);
-out_dev:
-	unregister_netdev(dev);
+
+out_free:
 	kfree(dev);
 out_region:
 	release_region(OAKNET_IO_BASE, OAKNET_IO_SIZE);
@@ -682,12 +676,11 @@
 
 	if (oaknet_devs->priv != NULL) {
 		int ioaddr = oaknet_devs->base_addr;
-		void *priv = oaknet_devs->priv;
 		free_irq(oaknet_devs->irq, oaknet_devs);
 		release_region(ioaddr, OAKNET_IO_SIZE);
 		iounmap(ioaddr);
-		unregister_netdev(oaknet_dev);
-		kfree(priv);
+		unregister_netdev(oaknet_devs);
+		kfree(oaknet_devs);
 	}
 
 	/* Convert to loop once driver supports multiple devices. */

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux