netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Jeff Garzik <jgarzik@pobox.com>, Jes Sorenson <jes@trained-monkey.org>
Cc: netdev@oss.sgi.com
Subject: [PATCH 2.5.70] acenic -- update to use alloc_etherdev
Date: Wed, 11 Jun 2003 14:42:49 -0700	[thread overview]
Message-ID: <20030611144249.7cd63c1c.shemminger@osdl.org> (raw)

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) {

             reply	other threads:[~2003-06-11 21:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-11 21:42 Stephen Hemminger [this message]
2003-06-11 22:21 ` [PATCH 2.5.70] acenic -- update to use alloc_etherdev Jes Sorensen
2003-06-12  4:04   ` David S. Miller
     [not found]     ` <3EE81263.4040205@osdl.org>
2003-06-12  5:43       ` David S. Miller
2003-06-12 17:05       ` Jes Sorensen
2003-06-12  5:44     ` Stephen Hemminger
2003-06-12 17:01     ` Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030611144249.7cd63c1c.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=jes@trained-monkey.org \
    --cc=jgarzik@pobox.com \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).