netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.70] acenic -- update to use alloc_etherdev
@ 2003-06-11 21:42 Stephen Hemminger
  2003-06-11 22:21 ` Jes Sorensen
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Hemminger @ 2003-06-11 21:42 UTC (permalink / raw)
  To: Jeff Garzik, Jes Sorenson; +Cc: netdev

Updated acenic driver to use alloc_etherdev to hold private data structure.
Uses register_netdev() to get the name right this time ;-)

Tested against 2.5.70 bk latest on Tigon III board.

diff -Nru a/drivers/net/acenic.c b/drivers/net/acenic.c
--- a/drivers/net/acenic.c	Wed Jun 11 14:36:47 2003
+++ b/drivers/net/acenic.c	Wed Jun 11 14:36:47 2003
@@ -642,8 +642,7 @@
 		      (pdev->device == PCI_DEVICE_ID_SGI_ACENIC)))
 			continue;
 
-		dev = init_etherdev(NULL, sizeof(struct ace_private));
-
+		dev = alloc_etherdev(sizeof(struct ace_private));
 		if (dev == NULL) {
 			printk(KERN_ERR "acenic: Unable to allocate "
 			       "net_device structure!\n");
@@ -653,13 +652,6 @@
 		SET_MODULE_OWNER(dev);
 		SET_NETDEV_DEV(dev, &pdev->dev);
 
-		if (!dev->priv)
-			dev->priv = kmalloc(sizeof(*ap), GFP_KERNEL);
-		if (!dev->priv) {
-			printk(KERN_ERR "acenic: Unable to allocate memory\n");
-			return -ENOMEM;
-		}
-
 		ap = dev->priv;
 		ap->pdev = pdev;
 
@@ -737,6 +729,12 @@
 			       "AceNIC %i will be disabled.\n",
 			       dev->name, boards_found);
 			break;
+		}
+
+		if (register_netdev(dev)) {
+			printk(KERN_ERR "acenic: device registration failed\n");
+			kfree(dev);
+			continue;
 		}
 
 		switch(pdev->vendor) {

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-06-12 17:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-11 21:42 [PATCH 2.5.70] acenic -- update to use alloc_etherdev Stephen Hemminger
2003-06-11 22:21 ` Jes Sorensen
2003-06-12  4:04   ` David S. Miller
2003-06-12  5:44     ` Stephen Hemminger
2003-06-12 17:01     ` Jes Sorensen
     [not found]     ` <3EE81263.4040205@osdl.org>
2003-06-12  5:43       ` David S. Miller
2003-06-12 17:05       ` Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).