提交 5e47879f 编写于 作者: W Wang Chen 提交者: David S. Miller

[IRDA]: 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.
Signed-off-by: NWang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0bc8c7bf
...@@ -76,9 +76,11 @@ static int __init ircomm_init(void) ...@@ -76,9 +76,11 @@ static int __init ircomm_init(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
{ struct proc_dir_entry *ent; { struct proc_dir_entry *ent;
ent = create_proc_entry("ircomm", 0, proc_irda); ent = proc_create("ircomm", 0, proc_irda, &ircomm_proc_fops);
if (ent) if (!ent) {
ent->proc_fops = &ircomm_proc_fops; printk(KERN_ERR "ircomm_init: can't create /proc entry!\n");
return -ENODEV;
}
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
......
...@@ -128,13 +128,11 @@ static int __init irlan_init(void) ...@@ -128,13 +128,11 @@ static int __init irlan_init(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
{ struct proc_dir_entry *proc; { struct proc_dir_entry *proc;
proc = create_proc_entry("irlan", 0, proc_irda); proc = proc_create("irlan", 0, proc_irda, &irlan_fops);
if (!proc) { if (!proc) {
printk(KERN_ERR "irlan_init: can't create /proc entry!\n"); printk(KERN_ERR "irlan_init: can't create /proc entry!\n");
return -ENODEV; return -ENODEV;
} }
proc->proc_fops = &irlan_fops;
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
......
...@@ -72,11 +72,9 @@ void __init irda_proc_register(void) ...@@ -72,11 +72,9 @@ void __init irda_proc_register(void)
return; return;
proc_irda->owner = THIS_MODULE; proc_irda->owner = THIS_MODULE;
for (i=0; i<ARRAY_SIZE(irda_dirs); i++) { for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
d = create_proc_entry(irda_dirs[i].name, 0, proc_irda); d = proc_create(irda_dirs[i].name, 0, proc_irda,
if (d) irda_dirs[i].fops);
d->proc_fops = irda_dirs[i].fops;
}
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册