netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/2][fyi] alloc_ei_netdev() example: ne2k-pci
@ 2003-09-01 17:56 Jeff Garzik
  0 siblings, 0 replies; only message in thread
From: Jeff Garzik @ 2003-09-01 17:56 UTC (permalink / raw)
  To: netdev, linux-net



# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1120  -> 1.1121 
#	drivers/net/ne2k-pci.c	1.9     -> 1.10   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/01	jgarzik@redhat.com	1.1121
# [netdrvr ne2k-pci] allocate netdev+8390 struct using new alloc_ei_netdev()
# 
# Also, call pci_disable_device() in PCI ->remove handler,
# to match pci_enable_device() in PCI ->probe handler.
# --------------------------------------------
#
diff -Nru a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
--- a/drivers/net/ne2k-pci.c	Mon Sep  1 13:48:30 2003
+++ b/drivers/net/ne2k-pci.c	Mon Sep  1 13:48:30 2003
@@ -259,7 +259,8 @@
 		}
 	}
 
-	dev = alloc_etherdev(0);
+	/* Allocate net_device, dev->priv; fill in 8390 specific dev fields. */
+	dev = alloc_ei_netdev();
 	if (!dev) {
 		printk (KERN_ERR PFX "cannot allocate ethernet device\n");
 		goto err_out_free_res;
@@ -330,13 +331,6 @@
 	dev->base_addr = ioaddr;
 	pci_set_drvdata(pdev, dev);
 
-	/* Allocate dev->priv and fill in 8390 specific dev fields. */
-	if (ethdev_init(dev)) {
-		printk (KERN_ERR "ne2kpci(%s): unable to get memory for dev->priv.\n",
-			pdev->slot_name);
-		goto err_out_free_netdev;
-	}
-
 	ei_status.name = pci_clone_list[chip_idx].name;
 	ei_status.tx_start_page = start_page;
 	ei_status.stop_page = stop_page;
@@ -365,7 +359,7 @@
 
 	i = register_netdev(dev);
 	if (i)
-		goto err_out_free_8390;
+		goto err_out_free_netdev;
 
 	printk("%s: %s found at %#lx, IRQ %d, ",
 		   dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq);
@@ -376,8 +370,6 @@
 
 	return 0;
 
-err_out_free_8390:
-	kfree(dev->priv);
 err_out_free_netdev:
 	kfree (dev);
 err_out_free_res:
@@ -634,7 +626,7 @@
 
 	unregister_netdev(dev);
 	release_region(dev->base_addr, NE_IO_EXTENT);
-	kfree(dev->priv);
+	pci_disable_device(pdev);
 	kfree(dev);
 	pci_set_drvdata(pdev, NULL);
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-09-01 17:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-01 17:56 [patch 2/2][fyi] alloc_ei_netdev() example: ne2k-pci Jeff Garzik

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