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 13/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/8021q/vlanproc.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
net/8021q/vlanproc.c +4 -7
index a0ec479..146cfb0 100644
@@ -161,11 +161,10 @@ int __init vlan_proc_init(void)
 	if (!proc_vlan_dir)
 		goto err;
 
-	proc_vlan_conf = create_proc_entry(name_conf, S_IFREG|S_IRUSR|S_IWUSR,
-					   proc_vlan_dir);
+	proc_vlan_conf = proc_create(name_conf, S_IFREG|S_IRUSR|S_IWUSR,
+				     proc_vlan_dir, &vlan_fops);
 	if (!proc_vlan_conf)
 		goto err;
-	proc_vlan_conf->proc_fops = &vlan_fops;
 	return 0;
 
 err:
@@ -182,13 +181,11 @@ int vlan_proc_add_dev(struct net_device *vlandev)
 {
 	struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
 
-	dev_info->dent = create_proc_entry(vlandev->name,
-					   S_IFREG|S_IRUSR|S_IWUSR,
-					   proc_vlan_dir);
+	dev_info->dent = proc_create(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR,
+				     proc_vlan_dir, &vlandev_fops);
 	if (!dev_info->dent)
 		return -ENOBUFS;
 
-	dev_info->dent->proc_fops = &vlandev_fops;
 	dev_info->dent->data = vlandev;
 	return 0;
 }
Signature · 1 line
WCN
maintainer Applied
#1 lore raw

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

Quoted 4 lines

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

Applied.

Quoted 6 lines
net/8021q/vlanproc.c +0 -2
@@ -182,13 +181,11 @@ int vlan_proc_add_dev(struct net_device *vlandev)
 {
 	struct vlan_dev_info *dev_info = vlan_dev_info(vlandev);
 
-	dev_info->dent = create_proc_entry(vlandev->name,
-					   S_IFREG|S_IRUSR|S_IWUSR,

net/8021q/vlanproc.c int vlan_proc_add_dev(struct net_device *vlandev) · line 191

Quoted 10 lines
net/8021q/vlanproc.c +2 -2
-					   proc_vlan_dir);
+	dev_info->dent = proc_create(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR,
+				     proc_vlan_dir, &vlandev_fops);
 	if (!dev_info->dent)
 		return -ENOBUFS;
 
-	dev_info->dent->proc_fops = &vlandev_fops;
 	dev_info->dent->data = vlandev;
 	return 0;
 }

->data visibility issue