Merge branch 'v3.5-rc7-fixes' of git://github.com/lunn/linux into fixes
[cascardo/linux.git] / fs / debugfs / inode.c
index d423b96..d17c20f 100644 (file)
@@ -54,13 +54,12 @@ static struct inode *debugfs_get_inode(struct super_block *sb, umode_t mode, dev
                        break;
                case S_IFLNK:
                        inode->i_op = &debugfs_link_operations;
-                       inode->i_fop = fops;
                        inode->i_private = data;
                        break;
                case S_IFDIR:
                        inode->i_op = &simple_dir_inode_operations;
-                       inode->i_fop = fops ? fops : &simple_dir_operations;
-                       inode->i_private = data;
+                       inode->i_fop = &simple_dir_operations;
+                       inode->i_private = NULL;
 
                        /* directory inodes start off with i_nlink == 2
                         * (for "." entry) */
@@ -91,13 +90,12 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
        return error;
 }
 
-static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode,
-                        void *data, const struct file_operations *fops)
+static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
        int res;
 
        mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
-       res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
+       res = debugfs_mknod(dir, dentry, mode, 0, NULL, NULL);
        if (!res) {
                inc_nlink(dir);
                fsnotify_mkdir(dir, dentry);
@@ -106,10 +104,10 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode,
 }
 
 static int debugfs_link(struct inode *dir, struct dentry *dentry, umode_t mode,
-                       void *data, const struct file_operations *fops)
+                       void *data)
 {
        mode = (mode & S_IALLUGO) | S_IFLNK;
-       return debugfs_mknod(dir, dentry, mode, 0, data, fops);
+       return debugfs_mknod(dir, dentry, mode, 0, data, NULL);
 }
 
 static int debugfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
@@ -293,13 +291,19 @@ static struct file_system_type debug_fs_type = {
        .kill_sb =      kill_litter_super,
 };
 
-static int debugfs_create_by_name(const char *name, umode_t mode,
-                                 struct dentry *parent,
-                                 struct dentry **dentry,
-                                 void *data,
-                                 const struct file_operations *fops)
+struct dentry *__create_file(const char *name, umode_t mode,
+                                  struct dentry *parent, void *data,
+                                  const struct file_operations *fops)
 {
-       int error = 0;
+       struct dentry *dentry = NULL;
+       int error;
+
+       pr_debug("debugfs: creating file '%s'\n",name);
+
+       error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
+                             &debugfs_mount_count);
+       if (error)
+               goto exit;
 
        /* If the parent is not specified, we create it in the root.
         * We need the root dentry to do this, which is in the super 
@@ -309,48 +313,29 @@ static int debugfs_create_by_name(const char *name, umode_t mode,
        if (!parent)
                parent = debugfs_mount->mnt_root;
 
-       *dentry = NULL;
+       dentry = NULL;
        mutex_lock(&parent->d_inode->i_mutex);
-       *dentry = lookup_one_len(name, parent, strlen(name));
-       if (!IS_ERR(*dentry)) {
+       dentry = lookup_one_len(name, parent, strlen(name));
+       if (!IS_ERR(dentry)) {
                switch (mode & S_IFMT) {
                case S_IFDIR:
-                       error = debugfs_mkdir(parent->d_inode, *dentry, mode,
-                                             data, fops);
+                       error = debugfs_mkdir(parent->d_inode, dentry, mode);
+                                             
                        break;
                case S_IFLNK:
-                       error = debugfs_link(parent->d_inode, *dentry, mode,
-                                            data, fops);
+                       error = debugfs_link(parent->d_inode, dentry, mode,
+                                            data);
                        break;
                default:
-                       error = debugfs_create(parent->d_inode, *dentry, mode,
+                       error = debugfs_create(parent->d_inode, dentry, mode,
                                               data, fops);
                        break;
                }
-               dput(*dentry);
+               dput(dentry);
        } else
-               error = PTR_ERR(*dentry);
+               error = PTR_ERR(dentry);
        mutex_unlock(&parent->d_inode->i_mutex);
 
-       return error;
-}
-
-struct dentry *__create_file(const char *name, umode_t mode,
-                                  struct dentry *parent, void *data,
-                                  const struct file_operations *fops)
-{
-       struct dentry *dentry = NULL;
-       int error;
-
-       pr_debug("debugfs: creating file '%s'\n",name);
-
-       error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
-                             &debugfs_mount_count);
-       if (error)
-               goto exit;
-
-       error = debugfs_create_by_name(name, mode, parent, &dentry,
-                                      data, fops);
        if (error) {
                dentry = NULL;
                simple_release_fs(&debugfs_mount, &debugfs_mount_count);