Skip to contentSkip to conversation

: Use proc_create() to setup ->proc_fops first

PATCH Applied Wang Chen 2 participants 2 messages Feb 28, 2008

Subsystems (2)
lore
Share & tools
lore

Wang Chen

author
#0 lore raw

PATCH 14/15 : Use proc_create() to setup ->proc_fops first

Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to main tree.

---
 net/wanrouter/wanproc.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
net/wanrouter/wanproc.c +4 -6
index f2e54c3..5bebe40 100644
@@ -292,14 +292,12 @@ int __init wanrouter_proc_init(void)
 	if (!proc_router)
 		goto fail;
 
-	p = create_proc_entry("config", S_IRUGO, proc_router);
+	p = proc_create("config", S_IRUGO, proc_router, &config_fops);
 	if (!p)
 		goto fail_config;
-	p->proc_fops = &config_fops;
-	p = create_proc_entry("status", S_IRUGO, proc_router);
+	p = proc_create("status", S_IRUGO, proc_router, &status_fops);
 	if (!p)
 		goto fail_stat;
-	p->proc_fops = &status_fops;
 	return 0;
 fail_stat:
 	remove_proc_entry("config", proc_router);
@@ -329,10 +327,10 @@ int wanrouter_proc_add(struct wan_device* wandev)
 	if (wandev->magic != ROUTER_MAGIC)
 		return -EINVAL;
 
-	wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router);
+	wandev->dent = proc_create(wandev->name, S_IRUGO,
+				   proc_router, &wandev_fops);
 	if (!wandev->dent)
 		return -ENOMEM;
-	wandev->dent->proc_fops	= &wandev_fops;
 	wandev->dent->data	= wandev;
 	return 0;
 }
Signature · 1 line
WCN
maintainer Applied
#1 lore raw

From: Wang Chen <[email protected]>
Date: Thu, 28 Feb 2008 18:58:35 +0800

Quoted 4 lines

Use proc_create() to make sure that ->proc_fops be setup before gluing PDE to main tree.

Applied.

net/wanrouter/wanproc.c int wanrouter_proc_add(struct wan_device* wandev) · line 336

Quoted 13 lines
net/wanrouter/wanproc.c +2 -2
@@ -329,10 +327,10 @@ int wanrouter_proc_add(struct wan_device* wandev)
 	if (wandev->magic != ROUTER_MAGIC)
 		return -EINVAL;
 
-	wandev->dent = create_proc_entry(wandev->name, S_IRUGO, proc_router);
+	wandev->dent = proc_create(wandev->name, S_IRUGO,
+				   proc_router, &wandev_fops);
 	if (!wandev->dent)
 		return -ENOMEM;
-	wandev->dent->proc_fops	= &wandev_fops;
 	wandev->dent->data	= wandev;
 	return 0;
 }

->data visibility issue