isdn: use non-racy method for proc entries creation
[pandora-kernel.git] / drivers / isdn / divert / divert_procfs.c
index be77ee6..8b256a6 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/fs.h>
 #endif
 #include <linux/isdnif.h>
+#include <net/net_namespace.h>
 #include "isdn_divert.h"
 
 
@@ -70,6 +71,8 @@ put_info_buffer(char *cp)
        wake_up_interruptible(&(rd_queue));
 }                              /* put_info_buffer */
 
+#ifdef CONFIG_PROC_FS
+
 /**********************************/
 /* deflection device read routine */
 /**********************************/
@@ -253,8 +256,6 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
        return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
 }                              /* isdn_divert_ioctl */
 
-
-#ifdef CONFIG_PROC_FS
 static const struct file_operations isdn_fops =
 {
        .owner          = THIS_MODULE,
@@ -284,16 +285,15 @@ divert_dev_init(void)
        init_waitqueue_head(&rd_queue);
 
 #ifdef CONFIG_PROC_FS
-       isdn_proc_entry = proc_mkdir("net/isdn", NULL);
+       isdn_proc_entry = proc_mkdir("isdn", init_net.proc_net);
        if (!isdn_proc_entry)
                return (-1);
-       isdn_divert_entry = create_proc_entry("divert", S_IFREG | S_IRUGO, isdn_proc_entry);
+       isdn_divert_entry = proc_create("divert", S_IFREG | S_IRUGO,
+                                       isdn_proc_entry, &isdn_fops);
        if (!isdn_divert_entry) {
-               remove_proc_entry("net/isdn", NULL);
+               remove_proc_entry("isdn", init_net.proc_net);
                return (-1);
        }
-       isdn_divert_entry->proc_fops = &isdn_fops; 
-       isdn_divert_entry->owner = THIS_MODULE; 
 #endif /* CONFIG_PROC_FS */
 
        return (0);
@@ -309,7 +309,7 @@ divert_dev_deinit(void)
 
 #ifdef CONFIG_PROC_FS
        remove_proc_entry("divert", isdn_proc_entry);
-       remove_proc_entry("net/isdn", NULL);
+       remove_proc_entry("isdn", init_net.proc_net);
 #endif /* CONFIG_PROC_FS */
 
        return (0);