Skip to content

Commit

Permalink
[ATM]: Use proc_create() to setup ->proc_fops first
Browse files Browse the repository at this point in the history
Use proc_create() to make sure that ->proc_fops be setup before gluing
PDE to main tree.

Signed-off-by: Wang Chen <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Wang Chen authored and davem330 committed Feb 28, 2008
1 parent ed2b5b4 commit 16e297b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions net/atm/br2684.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,9 @@ static int __init br2684_init(void)
{
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *p;
if ((p = create_proc_entry("br2684", 0, atm_proc_root)) == NULL)
p = proc_create("br2684", 0, atm_proc_root, &br2684_proc_ops);
if (p == NULL)
return -ENOMEM;
p->proc_fops = &br2684_proc_ops;
#endif
register_atm_ioctl(&br2684_ioctl_ops);
return 0;
Expand Down
4 changes: 1 addition & 3 deletions net/atm/clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,7 @@ static int __init atm_clip_init(void)
{
struct proc_dir_entry *p;

p = create_proc_entry("arp", S_IRUGO, atm_proc_root);
if (p)
p->proc_fops = &arp_seq_fops;
p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
}
#endif

Expand Down
4 changes: 1 addition & 3 deletions net/atm/lec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1249,9 +1249,7 @@ static int __init lane_module_init(void)
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *p;

p = create_proc_entry("lec", S_IRUGO, atm_proc_root);
if (p)
p->proc_fops = &lec_seq_fops;
p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
#endif

register_atm_ioctl(&lane_ioctl_ops);
Expand Down
3 changes: 1 addition & 2 deletions net/atm/mpoa_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,11 @@ int mpc_proc_init(void)
{
struct proc_dir_entry *p;

p = create_proc_entry(STAT_FILE_NAME, 0, atm_proc_root);
p = proc_create(STAT_FILE_NAME, 0, atm_proc_root, &mpc_file_operations);
if (!p) {
printk(KERN_ERR "Unable to initialize /proc/atm/%s\n", STAT_FILE_NAME);
return -ENOMEM;
}
p->proc_fops = &mpc_file_operations;
p->owner = THIS_MODULE;
return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions net/atm/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,11 +435,11 @@ int atm_proc_dev_register(struct atm_dev *dev)
goto err_out;
sprintf(dev->proc_name,"%s:%d",dev->type, dev->number);

dev->proc_entry = create_proc_entry(dev->proc_name, 0, atm_proc_root);
dev->proc_entry = proc_create(dev->proc_name, 0, atm_proc_root,
&proc_atm_dev_ops);
if (!dev->proc_entry)
goto err_free_name;
dev->proc_entry->data = dev;
dev->proc_entry->proc_fops = &proc_atm_dev_ops;
dev->proc_entry->owner = THIS_MODULE;
return 0;
err_free_name:
Expand Down Expand Up @@ -492,10 +492,10 @@ int __init atm_proc_init(void)
for (e = atm_proc_ents; e->name; e++) {
struct proc_dir_entry *dirent;

dirent = create_proc_entry(e->name, S_IRUGO, atm_proc_root);
dirent = proc_create(e->name, S_IRUGO,
atm_proc_root, e->proc_fops);
if (!dirent)
goto err_out_remove;
dirent->proc_fops = e->proc_fops;
dirent->owner = THIS_MODULE;
e->dirent = dirent;
}
Expand Down

0 comments on commit 16e297b

Please sign in to comment.