summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cxl
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2018-06-09 15:45:56 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2018-07-12 16:04:25 +0200
commit908f7ca1731142e49e802b0277e94853cd772a8d (patch)
treebed1a0259f78d4a7afba4a3d1e1e6ccf78b121ff /drivers/misc/cxl
parent... and switch shmem_file_setup() to alloc_file_pseudo() (diff)
downloadlinux-908f7ca1731142e49e802b0277e94853cd772a8d.tar.xz
linux-908f7ca1731142e49e802b0277e94853cd772a8d.zip
cxl_getfile(): switch to alloc_file_pseudo()
Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/misc/cxl')
-rw-r--r--drivers/misc/cxl/api.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/misc/cxl/api.c b/drivers/misc/cxl/api.c
index 0b5cb6cf91a0..8fd5ec4d6042 100644
--- a/drivers/misc/cxl/api.c
+++ b/drivers/misc/cxl/api.c
@@ -67,10 +67,8 @@ static struct file *cxl_getfile(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;
/* strongly inspired by anon_inode_getfile() */
@@ -91,22 +89,11 @@ static struct file *cxl_getfile(const char *name,
goto err_fs;
}
- file = ERR_PTR(-ENOMEM);
- this.name = name;
- this.len = strlen(name);
- this.hash = 0;
- path.dentry = d_alloc_pseudo(cxl_vfs_mount->mnt_sb, &this);
- if (!path.dentry)
+ file = alloc_file_pseudo(inode, cxl_vfs_mount, name,
+ flags & (O_ACCMODE | O_NONBLOCK), fops);
+ if (IS_ERR(file))
goto err_inode;
- path.mnt = mntget(cxl_vfs_mount);
- d_instantiate(path.dentry, inode);
-
- file = alloc_file(&path, flags & (O_ACCMODE | O_NONBLOCK), fops);
- if (IS_ERR(file)) {
- path_put(&path);
- goto err_fs;
- }
file->private_data = priv;
return file;