mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-04-01 12:04:08 +00:00
ocxlflash_getfile(): switch to alloc_file_pseudo()
Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
908f7ca173
commit
118f486861
1 changed files with 4 additions and 19 deletions
|
@ -88,10 +88,8 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
|
||||||
const struct file_operations *fops,
|
const struct file_operations *fops,
|
||||||
void *priv, int flags)
|
void *priv, int flags)
|
||||||
{
|
{
|
||||||
struct qstr this;
|
|
||||||
struct path path;
|
|
||||||
struct file *file;
|
struct file *file;
|
||||||
struct inode *inode = NULL;
|
struct inode *inode;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (fops->owner && !try_module_get(fops->owner)) {
|
if (fops->owner && !try_module_get(fops->owner)) {
|
||||||
|
@ -116,26 +114,13 @@ static struct file *ocxlflash_getfile(struct device *dev, const char *name,
|
||||||
goto err3;
|
goto err3;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.name = name;
|
file = alloc_file_pseudo(inode, ocxlflash_vfs_mount, name,
|
||||||
this.len = strlen(name);
|
flags & (O_ACCMODE | O_NONBLOCK), fops);
|
||||||
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, flags & (O_ACCMODE | O_NONBLOCK), fops);
|
|
||||||
if (IS_ERR(file)) {
|
if (IS_ERR(file)) {
|
||||||
rc = PTR_ERR(file);
|
rc = PTR_ERR(file);
|
||||||
dev_err(dev, "%s: alloc_file failed rc=%d\n",
|
dev_err(dev, "%s: alloc_file failed rc=%d\n",
|
||||||
__func__, rc);
|
__func__, rc);
|
||||||
path_put(&path);
|
goto err4;
|
||||||
goto err3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file->private_data = priv;
|
file->private_data = priv;
|
||||||
|
|
Loading…
Add table
Reference in a new issue