gadgetfs: saner API for gadgetfs_create_file()
return dentry, not inode. dev->inode is never used by anything, don't bother with storing it. Acked-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
1bb27cacf4
commit
fb6c3225b4
1 changed files with 10 additions and 16 deletions
|
@ -198,7 +198,6 @@ struct ep_data {
|
||||||
struct list_head epfiles;
|
struct list_head epfiles;
|
||||||
wait_queue_head_t wait;
|
wait_queue_head_t wait;
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *inode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void get_ep (struct ep_data *data)
|
static inline void get_ep (struct ep_data *data)
|
||||||
|
@ -1618,10 +1617,9 @@ static void destroy_ep_files (struct dev_data *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct inode *
|
static struct dentry *
|
||||||
gadgetfs_create_file (struct super_block *sb, char const *name,
|
gadgetfs_create_file (struct super_block *sb, char const *name,
|
||||||
void *data, const struct file_operations *fops,
|
void *data, const struct file_operations *fops);
|
||||||
struct dentry **dentry_p);
|
|
||||||
|
|
||||||
static int activate_ep_files (struct dev_data *dev)
|
static int activate_ep_files (struct dev_data *dev)
|
||||||
{
|
{
|
||||||
|
@ -1649,10 +1647,9 @@ static int activate_ep_files (struct dev_data *dev)
|
||||||
if (!data->req)
|
if (!data->req)
|
||||||
goto enomem1;
|
goto enomem1;
|
||||||
|
|
||||||
data->inode = gadgetfs_create_file (dev->sb, data->name,
|
data->dentry = gadgetfs_create_file (dev->sb, data->name,
|
||||||
data, &ep_config_operations,
|
data, &ep_config_operations);
|
||||||
&data->dentry);
|
if (!data->dentry)
|
||||||
if (!data->inode)
|
|
||||||
goto enomem2;
|
goto enomem2;
|
||||||
list_add_tail (&data->epfiles, &dev->epfiles);
|
list_add_tail (&data->epfiles, &dev->epfiles);
|
||||||
}
|
}
|
||||||
|
@ -2011,10 +2008,9 @@ gadgetfs_make_inode (struct super_block *sb,
|
||||||
/* creates in fs root directory, so non-renamable and non-linkable.
|
/* creates in fs root directory, so non-renamable and non-linkable.
|
||||||
* so inode and dentry are paired, until device reconfig.
|
* so inode and dentry are paired, until device reconfig.
|
||||||
*/
|
*/
|
||||||
static struct inode *
|
static struct dentry *
|
||||||
gadgetfs_create_file (struct super_block *sb, char const *name,
|
gadgetfs_create_file (struct super_block *sb, char const *name,
|
||||||
void *data, const struct file_operations *fops,
|
void *data, const struct file_operations *fops)
|
||||||
struct dentry **dentry_p)
|
|
||||||
{
|
{
|
||||||
struct dentry *dentry;
|
struct dentry *dentry;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
|
@ -2030,8 +2026,7 @@ gadgetfs_create_file (struct super_block *sb, char const *name,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
d_add (dentry, inode);
|
d_add (dentry, inode);
|
||||||
*dentry_p = dentry;
|
return dentry;
|
||||||
return inode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct super_operations gadget_fs_operations = {
|
static const struct super_operations gadget_fs_operations = {
|
||||||
|
@ -2079,9 +2074,8 @@ gadgetfs_fill_super (struct super_block *sb, void *opts, int silent)
|
||||||
goto Enomem;
|
goto Enomem;
|
||||||
|
|
||||||
dev->sb = sb;
|
dev->sb = sb;
|
||||||
if (!gadgetfs_create_file (sb, CHIP,
|
dev->dentry = gadgetfs_create_file(sb, CHIP, dev, &dev_init_operations);
|
||||||
dev, &dev_init_operations,
|
if (!dev->dentry) {
|
||||||
&dev->dentry)) {
|
|
||||||
put_dev(dev);
|
put_dev(dev);
|
||||||
goto Enomem;
|
goto Enomem;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue