netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.74] convert appletalk/ipddp to dynamic allocation
@ 2003-07-09 20:13 Stephen Hemminger
  2003-07-10 22:42 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2003-07-09 20:13 UTC (permalink / raw)
  To: Jeff Garzik, Jay Schulist; +Cc: netdev, linux-atalk

Part of the continuing campaign to fix all network devices to allocate dynamically.

Built, loaded/unloaded and configured but don't have real test environment to communicate
with other hosts.

diff -Nru a/drivers/net/appletalk/ipddp.c b/drivers/net/appletalk/ipddp.c
--- a/drivers/net/appletalk/ipddp.c	Wed Jul  9 12:55:44 2003
+++ b/drivers/net/appletalk/ipddp.c	Wed Jul  9 12:55:44 2003
@@ -72,17 +72,8 @@
 		printk("%s: Appletalk-IP Decap. mode by Jay Schulist <jschlst@samba.org>\n", 
 			dev->name);
 
-	/* Fill in the device structure with ethernet-generic values. */
-        ether_setup(dev);
-
 	/* Initalize the device structure. */
         dev->hard_start_xmit = ipddp_xmit;
-
-        dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);
-        if(!dev->priv)
-                return -ENOMEM;
-        memset(dev->priv,0,sizeof(struct net_device_stats));
-
         dev->get_stats      = ipddp_get_stats;
         dev->do_ioctl       = ipddp_ioctl;
 
@@ -281,7 +272,7 @@
         }
 }
 
-static struct net_device dev_ipddp;
+static struct net_device *dev_ipddp;
 
 MODULE_LICENSE("GPL");
 MODULE_PARM(ipddp_mode, "i");
@@ -290,29 +281,33 @@
 {
 	int err;
 
-	dev_ipddp.init = ipddp_init;
-	err=dev_alloc_name(&dev_ipddp, "ipddp%d");
-        if(err < 0)
-                return err;
+	dev_ipddp = alloc_netdev(sizeof(struct net_device_stats), 
+				 "ipddp%d", ether_setup);
 
-	if(register_netdev(&dev_ipddp) != 0)
-                return -EIO;
+	if (!dev_ipddp)
+		return -ENOMEM;
 
-	return 0;
+	dev_ipddp->init = ipddp_init;
+
+	if((err = register_netdev(dev_ipddp)))
+	   kfree(dev_ipddp);
+
+	return err;
 }
 
 static void __exit ipddp_cleanup_module(void)
 {
         struct ipddp_route *p;
 
-	unregister_netdev(&dev_ipddp);
-        kfree(dev_ipddp.priv);
+	unregister_netdev(dev_ipddp);
 
         while (ipddp_route_list) {
                 p = ipddp_route_list->next;
                 kfree(ipddp_route_list);
                 ipddp_route_list = p;
         }
+
+        kfree(dev_ipddp);
 }
 
 module_init(ipddp_init_module);

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

end of thread, other threads:[~2003-07-10 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-09 20:13 [PATCH 2.5.74] convert appletalk/ipddp to dynamic allocation Stephen Hemminger
2003-07-10 22:42 ` 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).