Commit 25296d59 authored by Wang Chen's avatar Wang Chen Committed by David S. Miller

[PKTGEN]: 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: default avatarWang Chen <wangchen@cn.fujitsu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46ecf0b9
...@@ -3570,14 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) ...@@ -3570,14 +3570,14 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
if (err) if (err)
goto out1; goto out1;
pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir); pkt_dev->entry = proc_create(ifname, 0600,
pg_proc_dir, &pktgen_if_fops);
if (!pkt_dev->entry) { if (!pkt_dev->entry) {
printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
PG_PROC_DIR, ifname); PG_PROC_DIR, ifname);
err = -EINVAL; err = -EINVAL;
goto out2; goto out2;
} }
pkt_dev->entry->proc_fops = &pktgen_if_fops;
pkt_dev->entry->data = pkt_dev; pkt_dev->entry->data = pkt_dev;
#ifdef CONFIG_XFRM #ifdef CONFIG_XFRM
pkt_dev->ipsmode = XFRM_MODE_TRANSPORT; pkt_dev->ipsmode = XFRM_MODE_TRANSPORT;
...@@ -3628,7 +3628,7 @@ static int __init pktgen_create_thread(int cpu) ...@@ -3628,7 +3628,7 @@ static int __init pktgen_create_thread(int cpu)
kthread_bind(p, cpu); kthread_bind(p, cpu);
t->tsk = p; t->tsk = p;
pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir); pe = proc_create(t->tsk->comm, 0600, pg_proc_dir, &pktgen_thread_fops);
if (!pe) { if (!pe) {
printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n", printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
PG_PROC_DIR, t->tsk->comm); PG_PROC_DIR, t->tsk->comm);
...@@ -3638,7 +3638,6 @@ static int __init pktgen_create_thread(int cpu) ...@@ -3638,7 +3638,6 @@ static int __init pktgen_create_thread(int cpu)
return -EINVAL; return -EINVAL;
} }
pe->proc_fops = &pktgen_thread_fops;
pe->data = t; pe->data = t;
wake_up_process(p); wake_up_process(p);
...@@ -3709,7 +3708,7 @@ static int __init pg_init(void) ...@@ -3709,7 +3708,7 @@ static int __init pg_init(void)
return -ENODEV; return -ENODEV;
pg_proc_dir->owner = THIS_MODULE; pg_proc_dir->owner = THIS_MODULE;
pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir); pe = proc_create(PGCTRL, 0600, pg_proc_dir, &pktgen_fops);
if (pe == NULL) { if (pe == NULL) {
printk(KERN_ERR "pktgen: ERROR: cannot create %s " printk(KERN_ERR "pktgen: ERROR: cannot create %s "
"procfs entry.\n", PGCTRL); "procfs entry.\n", PGCTRL);
...@@ -3717,7 +3716,6 @@ static int __init pg_init(void) ...@@ -3717,7 +3716,6 @@ static int __init pg_init(void)
return -EINVAL; return -EINVAL;
} }
pe->proc_fops = &pktgen_fops;
pe->data = NULL; pe->data = NULL;
/* Register us to receive netdevice events */ /* Register us to receive netdevice events */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment