* [PATCH 06/15] [IRDA]: Use proc_create() to setup ->proc_fops first
@ 2008-02-28 10:56 Wang Chen
2008-02-28 22:08 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Wang Chen @ 2008-02-28 10:56 UTC (permalink / raw)
To: David S. Miller, NETDEV
Use proc_create() to make sure that ->proc_fops be setup before gluing
PDE to main tree.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
net/irda/ircomm/ircomm_core.c | 7 ++-----
net/irda/irlan/irlan_common.c | 7 ++-----
net/irda/irproc.c | 8 +++-----
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index b825399..aeaa30e 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -75,11 +75,8 @@ static int __init ircomm_init(void)
}
#ifdef CONFIG_PROC_FS
- { struct proc_dir_entry *ent;
- ent = create_proc_entry("ircomm", 0, proc_irda);
- if (ent)
- ent->proc_fops = &ircomm_proc_fops;
- }
+ struct proc_dir_entry *ent;
+ ent = proc_create("ircomm", 0, proc_irda, &ircomm_proc_fops);
#endif /* CONFIG_PROC_FS */
IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n");
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index a4b56e2..2325f94 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -127,15 +127,12 @@ static int __init irlan_init(void)
IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
#ifdef CONFIG_PROC_FS
- { struct proc_dir_entry *proc;
- proc = create_proc_entry("irlan", 0, proc_irda);
+ struct proc_dir_entry *proc;
+ proc = proc_create("irlan", 0, proc_irda, &irlan_fops);
if (!proc) {
printk(KERN_ERR "irlan_init: can't create /proc entry!\n");
return -ENODEV;
}
-
- proc->proc_fops = &irlan_fops;
- }
#endif /* CONFIG_PROC_FS */
IRDA_DEBUG(4, "%s()\n", __FUNCTION__ );
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index cae24fb..0ce80de 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -72,11 +72,9 @@ void __init irda_proc_register(void)
return;
proc_irda->owner = THIS_MODULE;
- for (i=0; i<ARRAY_SIZE(irda_dirs); i++) {
- d = create_proc_entry(irda_dirs[i].name, 0, proc_irda);
- if (d)
- d->proc_fops = irda_dirs[i].fops;
- }
+ for (i=0; i<ARRAY_SIZE(irda_dirs); i++)
+ d = proc_create(irda_dirs[i].name, 0, proc_irda,
+ irda_dirs[i].fops);
}
/*
--
WCN
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 06/15] [IRDA]: Use proc_create() to setup ->proc_fops first
2008-02-28 10:56 [PATCH 06/15] [IRDA]: Use proc_create() to setup ->proc_fops first Wang Chen
@ 2008-02-28 22:08 ` David Miller
2008-02-29 7:10 ` take#2 " Wang Chen
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2008-02-28 22:08 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Thu, 28 Feb 2008 18:56:39 +0800
> @@ -75,11 +75,8 @@ static int __init ircomm_init(void)
> }
>
> #ifdef CONFIG_PROC_FS
> - { struct proc_dir_entry *ent;
> - ent = create_proc_entry("ircomm", 0, proc_irda);
> - if (ent)
> - ent->proc_fops = &ircomm_proc_fops;
> - }
> + struct proc_dir_entry *ent;
> + ent = proc_create("ircomm", 0, proc_irda, &ircomm_proc_fops);
> #endif /* CONFIG_PROC_FS */
>
> IRDA_MESSAGE("IrCOMM protocol (Dag Brattli)\n");
This is not C++, you therefore cannot declare local variables in
arbitrary locations of the function body. That's what the braces
were there for, to create the necessary new local scope.
For certain versions of GCC this won't even build, newer versions
default to c99 or similar and therefore just so happen to work.
^ permalink raw reply [flat|nested] 4+ messages in thread
* take#2 [PATCH 06/15] [IRDA]: Use proc_create() to setup ->proc_fops first
2008-02-28 22:08 ` David Miller
@ 2008-02-29 7:10 ` Wang Chen
2008-02-29 18:35 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Wang Chen @ 2008-02-29 7:10 UTC (permalink / raw)
To: David Miller; +Cc: netdev
David Miller said the following on 2008-2-29 6:08:
>> #ifdef CONFIG_PROC_FS
>> - { struct proc_dir_entry *ent;
>> - ent = create_proc_entry("ircomm", 0, proc_irda);
>> - if (ent)
>> - ent->proc_fops = &ircomm_proc_fops;
>> - }
>> + struct proc_dir_entry *ent;
>> + ent = proc_create("ircomm", 0, proc_irda, &ircomm_proc_fops);
>> #endif /* CONFIG_PROC_FS */
> This is not C++, you therefore cannot declare local variables in
> arbitrary locations of the function body. That's what the braces
> were there for, to create the necessary new local scope.
>
> For certain versions of GCC this won't even build, newer versions
> default to c99 or similar and therefore just so happen to work.
>
Use proc_create() to make sure that ->proc_fops be setup before gluing
PDE to main tree.
Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
net/irda/ircomm/ircomm_core.c | 8 +++++---
net/irda/irlan/irlan_common.c | 4 +---
net/irda/irproc.c | 8 +++-----
3 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/net/irda/ircomm/ircomm_core.c b/net/irda/ircomm/ircomm_core.c
index b825399..6eef1f2 100644
--- a/net/irda/ircomm/ircomm_core.c
+++ b/net/irda/ircomm/ircomm_core.c
@@ -76,9 +76,11 @@ static int __init ircomm_init(void)
#ifdef CONFIG_PROC_FS
{ struct proc_dir_entry *ent;
- ent = create_proc_entry("ircomm", 0, proc_irda);
- if (ent)
- ent->proc_fops = &ircomm_proc_fops;
+ ent = proc_create("ircomm", 0, proc_irda, &ircomm_proc_fops);
+ if (!ent) {
+ printk(KERN_ERR "ircomm_init: can't create /proc entry!\n");
+ return -ENODEV;
+ }
}
#endif /* CONFIG_PROC_FS */
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c
index a4b56e2..1eb4bbc 100644
--- a/net/irda/irlan/irlan_common.c
+++ b/net/irda/irlan/irlan_common.c
@@ -128,13 +128,11 @@ static int __init irlan_init(void)
#ifdef CONFIG_PROC_FS
{ struct proc_dir_entry *proc;
- proc = create_proc_entry("irlan", 0, proc_irda);
+ proc = proc_create("irlan", 0, proc_irda, &irlan_fops);
if (!proc) {
printk(KERN_ERR "irlan_init: can't create /proc entry!\n");
return -ENODEV;
}
-
- proc->proc_fops = &irlan_fops;
}
#endif /* CONFIG_PROC_FS */
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index cae24fb..88e80a3 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -72,11 +72,9 @@ void __init irda_proc_register(void)
return;
proc_irda->owner = THIS_MODULE;
- for (i=0; i<ARRAY_SIZE(irda_dirs); i++) {
- d = create_proc_entry(irda_dirs[i].name, 0, proc_irda);
- if (d)
- d->proc_fops = irda_dirs[i].fops;
- }
+ for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
+ d = proc_create(irda_dirs[i].name, 0, proc_irda,
+ irda_dirs[i].fops);
}
/*
--
WCN
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: take#2 [PATCH 06/15] [IRDA]: Use proc_create() to setup ->proc_fops first
2008-02-29 7:10 ` take#2 " Wang Chen
@ 2008-02-29 18:35 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2008-02-29 18:35 UTC (permalink / raw)
To: wangchen; +Cc: netdev
From: Wang Chen <wangchen@cn.fujitsu.com>
Date: Fri, 29 Feb 2008 15:10:10 +0800
> Use proc_create() to make sure that ->proc_fops be setup before gluing
> PDE to main tree.
>
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
Applied, thanks for fixing up this patch.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-29 18:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-28 10:56 [PATCH 06/15] [IRDA]: Use proc_create() to setup ->proc_fops first Wang Chen
2008-02-28 22:08 ` David Miller
2008-02-29 7:10 ` take#2 " Wang Chen
2008-02-29 18:35 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).