patch-2.4.4 linux/drivers/net/appletalk/ipddp.c
Next file: linux/drivers/net/appletalk/ltpc.c
Previous file: linux/drivers/net/appletalk/cops.c
Back to the patch index
Back to the overall index
- Lines: 108
- Date:
Fri Apr 13 20:26:07 2001
- Orig file:
v2.4.3/linux/drivers/net/appletalk/ipddp.c
- Orig date:
Sun Dec 3 17:45:22 2000
diff -u --recursive --new-file v2.4.3/linux/drivers/net/appletalk/ipddp.c linux/drivers/net/appletalk/ipddp.c
@@ -20,12 +20,9 @@
* Director, National Security Agency.
*
* This software may be used and distributed according to the terms
- * of the GNU Public License, incorporated herein by reference.
+ * of the GNU General Public License, incorporated herein by reference.
*/
-static const char *version =
- "ipddp.c:v0.01 8/28/97 Bradford W. Johnson <johns393@maroon.tc.umn.edu>\n";
-
#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
@@ -39,7 +36,9 @@
#include "ipddp.h" /* Our stuff */
-static struct ipddp_route *ipddp_route_list = NULL;
+static const char version[] = KERN_INFO "ipddp.c:v0.01 8/28/97 Bradford W. Johnson <johns393@maroon.tc.umn.edu>\n";
+
+static struct ipddp_route *ipddp_route_list;
#ifdef CONFIG_IPDDP_ENCAP
static int ipddp_mode = IPDDP_ENCAP;
@@ -47,12 +46,6 @@
static int ipddp_mode = IPDDP_DECAP;
#endif
-/* Use 0 for production, 1 for verification, 2 for debug, 3 for verbose debug */
-#ifndef IPDDP_DEBUG
-#define IPDDP_DEBUG 1
-#endif
-static unsigned int ipddp_debug = IPDDP_DEBUG;
-
/* Index to functions, as function prototypes. */
static int ipddp_xmit(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats *ipddp_get_stats(struct net_device *dev);
@@ -64,12 +57,12 @@
static int __init ipddp_init(struct net_device *dev)
{
- static unsigned version_printed = 0;
+ static unsigned version_printed;
SET_MODULE_OWNER(dev);
- if (ipddp_debug && version_printed++ == 0)
- printk("%s", version);
+ if (version_printed++ == 0)
+ printk(version);
/* Let the user now what mode we are in */
if(ipddp_mode == IPDDP_ENCAP)
@@ -193,25 +186,23 @@
static int ipddp_create(struct ipddp_route *new_rt)
{
struct ipddp_route *rt =(struct ipddp_route*) kmalloc(sizeof(*rt), GFP_KERNEL);
- struct ipddp_route *test;
- if(rt == NULL)
+ if (rt == NULL)
return -ENOMEM;
rt->ip = new_rt->ip;
rt->at = new_rt->at;
rt->next = NULL;
- rt->dev = atrtr_get_dev(&rt->at);
- if(rt->dev == NULL)
- {
- kfree(rt);
- return (-ENETUNREACH);
+ if ((rt->dev = atrtr_get_dev(&rt->at)) == NULL) {
+ kfree(rt);
+ return -ENETUNREACH;
}
- test = ipddp_find_route(rt);
- if(test != NULL)
- return (-EEXIST);
-
+ if (ipddp_find_route(rt)) {
+ kfree(rt);
+ return -EEXIST;
+ }
+
rt->next = ipddp_route_list;
ipddp_route_list = rt;
@@ -307,11 +298,16 @@
static void __exit ipddp_cleanup_module(void)
{
+ struct ipddp_route *p;
+
unregister_netdev(&dev_ipddp);
kfree(dev_ipddp.priv);
- memset(&dev_ipddp, 0, sizeof(dev_ipddp));
- dev_ipddp.init = ipddp_init;
+ while (ipddp_route_list) {
+ p = ipddp_route_list->next;
+ kfree(ipddp_route_list);
+ ipddp_route_list = p;
+ }
}
module_init(ipddp_init_module);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)