diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-09-03 13:32:19 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-10-09 02:39:14 -0400 |
commit | 1bb27cacf4992b77556ed4487f99c76c4af3b43d (patch) | |
tree | b6212f03c69417d1d63ed47ecac70510fd272301 /drivers/usb | |
parent | 9bb8730ed3d2658c6dd49b7f811231e2a0a2e3ed (diff) |
f_fs: saner API for ffs_sb_create_file()
make it return dentry instead of inode
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/function/f_fs.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 0dc3552d1360..4726e278e557 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -164,10 +164,9 @@ struct ffs_desc_helper { | |||
164 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); | 164 | static int __must_check ffs_epfiles_create(struct ffs_data *ffs); |
165 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); | 165 | static void ffs_epfiles_destroy(struct ffs_epfile *epfiles, unsigned count); |
166 | 166 | ||
167 | static struct inode *__must_check | 167 | static struct dentry * |
168 | ffs_sb_create_file(struct super_block *sb, const char *name, void *data, | 168 | ffs_sb_create_file(struct super_block *sb, const char *name, void *data, |
169 | const struct file_operations *fops, | 169 | const struct file_operations *fops); |
170 | struct dentry **dentry_p); | ||
171 | 170 | ||
172 | /* Devices management *******************************************************/ | 171 | /* Devices management *******************************************************/ |
173 | 172 | ||
@@ -1096,10 +1095,9 @@ ffs_sb_make_inode(struct super_block *sb, void *data, | |||
1096 | } | 1095 | } |
1097 | 1096 | ||
1098 | /* Create "regular" file */ | 1097 | /* Create "regular" file */ |
1099 | static struct inode *ffs_sb_create_file(struct super_block *sb, | 1098 | static struct dentry *ffs_sb_create_file(struct super_block *sb, |
1100 | const char *name, void *data, | 1099 | const char *name, void *data, |
1101 | const struct file_operations *fops, | 1100 | const struct file_operations *fops) |
1102 | struct dentry **dentry_p) | ||
1103 | { | 1101 | { |
1104 | struct ffs_data *ffs = sb->s_fs_info; | 1102 | struct ffs_data *ffs = sb->s_fs_info; |
1105 | struct dentry *dentry; | 1103 | struct dentry *dentry; |
@@ -1118,10 +1116,7 @@ static struct inode *ffs_sb_create_file(struct super_block *sb, | |||
1118 | } | 1116 | } |
1119 | 1117 | ||
1120 | d_add(dentry, inode); | 1118 | d_add(dentry, inode); |
1121 | if (dentry_p) | 1119 | return dentry; |
1122 | *dentry_p = dentry; | ||
1123 | |||
1124 | return inode; | ||
1125 | } | 1120 | } |
1126 | 1121 | ||
1127 | /* Super block */ | 1122 | /* Super block */ |
@@ -1166,7 +1161,7 @@ static int ffs_sb_fill(struct super_block *sb, void *_data, int silent) | |||
1166 | 1161 | ||
1167 | /* EP0 file */ | 1162 | /* EP0 file */ |
1168 | if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, | 1163 | if (unlikely(!ffs_sb_create_file(sb, "ep0", ffs, |
1169 | &ffs_ep0_operations, NULL))) | 1164 | &ffs_ep0_operations))) |
1170 | return -ENOMEM; | 1165 | return -ENOMEM; |
1171 | 1166 | ||
1172 | return 0; | 1167 | return 0; |
@@ -1535,9 +1530,10 @@ static int ffs_epfiles_create(struct ffs_data *ffs) | |||
1535 | mutex_init(&epfile->mutex); | 1530 | mutex_init(&epfile->mutex); |
1536 | init_waitqueue_head(&epfile->wait); | 1531 | init_waitqueue_head(&epfile->wait); |
1537 | sprintf(epfiles->name, "ep%u", i); | 1532 | sprintf(epfiles->name, "ep%u", i); |
1538 | if (!unlikely(ffs_sb_create_file(ffs->sb, epfiles->name, epfile, | 1533 | epfile->dentry = ffs_sb_create_file(ffs->sb, epfiles->name, |
1539 | &ffs_epfile_operations, | 1534 | epfile, |
1540 | &epfile->dentry))) { | 1535 | &ffs_epfile_operations); |
1536 | if (unlikely(!epfile->dentry)) { | ||
1541 | ffs_epfiles_destroy(epfiles, i - 1); | 1537 | ffs_epfiles_destroy(epfiles, i - 1); |
1542 | return -ENOMEM; | 1538 | return -ENOMEM; |
1543 | } | 1539 | } |