Merge branches 'work.misc' and 'work.dcache' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / drivers / scsi / cxlflash / ocxl_hw.c
index 497a6838946198b6bac403b38e2ecc76b9678ff7..a43d44e7e7dd86aece1d9f2545386921878d129a 100644 (file)
@@ -88,10 +88,8 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
                                      const struct file_operations *fops,
                                      void *priv, int flags)
 {
-       struct qstr this;
-       struct path path;
        struct file *file;
-       struct inode *inode = NULL;
+       struct inode *inode;
        int rc;
 
        if (fops->owner && !try_module_get(fops->owner)) {
@@ -116,29 +114,15 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
                goto err3;
        }
 
-       this.name = name;
-       this.len = strlen(name);
-       this.hash = 0;
-       path.dentry = d_alloc_pseudo(ocxlflash_vfs_mount->mnt_sb, &this);
-       if (!path.dentry) {
-               dev_err(dev, "%s: d_alloc_pseudo failed\n", __func__);
-               rc = -ENOMEM;
-               goto err4;
-       }
-
-       path.mnt = mntget(ocxlflash_vfs_mount);
-       d_instantiate(path.dentry, inode);
-
-       file = alloc_file(&path, OPEN_FMODE(flags), fops);
+       file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
+                                flags & (O_ACCMODE | O_NONBLOCK), fops);
        if (IS_ERR(file)) {
                rc = PTR_ERR(file);
                dev_err(dev, "%s: alloc_file failed rc=%d\n",
                        __func__, rc);
-               path_put(&path);
-               goto err3;
+               goto err4;
        }
 
-       file->f_flags = flags & (O_ACCMODE | O_NONBLOCK);
        file->private_data = priv;
 out:
        return file;