diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-03-24 14:43:24 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-03-27 23:49:12 -0400 |
commit | 87f15d4add758fb7fc76655721af94be57a4c17d (patch) | |
tree | a5e6d2048e83797da89ac23a22280bd2b37c05c9 /drivers/mtd | |
parent | f55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff) |
mtd: switch open_mtd_by_chdev() to use of vfs_stat()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ubi/build.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 22fd19c0c5d3..a7d1febf667a 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -1142,22 +1142,19 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway) | |||
1142 | */ | 1142 | */ |
1143 | static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) | 1143 | static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev) |
1144 | { | 1144 | { |
1145 | int err, major, minor, mode; | 1145 | struct kstat stat; |
1146 | struct path path; | 1146 | int err, minor; |
1147 | 1147 | ||
1148 | /* Probably this is an MTD character device node path */ | 1148 | /* Probably this is an MTD character device node path */ |
1149 | err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path); | 1149 | err = vfs_stat(mtd_dev, &stat); |
1150 | if (err) | 1150 | if (err) |
1151 | return ERR_PTR(err); | 1151 | return ERR_PTR(err); |
1152 | 1152 | ||
1153 | /* MTD device number is defined by the major / minor numbers */ | 1153 | /* MTD device number is defined by the major / minor numbers */ |
1154 | major = imajor(d_backing_inode(path.dentry)); | 1154 | if (MAJOR(stat.rdev) != MTD_CHAR_MAJOR || !S_ISCHR(stat.mode)) |
1155 | minor = iminor(d_backing_inode(path.dentry)); | ||
1156 | mode = d_backing_inode(path.dentry)->i_mode; | ||
1157 | path_put(&path); | ||
1158 | if (major != MTD_CHAR_MAJOR || !S_ISCHR(mode)) | ||
1159 | return ERR_PTR(-EINVAL); | 1155 | return ERR_PTR(-EINVAL); |
1160 | 1156 | ||
1157 | minor = MINOR(stat.rdev); | ||
1161 | if (minor & 1) | 1158 | if (minor & 1) |
1162 | /* | 1159 | /* |
1163 | * Just do not think the "/dev/mtdrX" devices support is need, | 1160 | * Just do not think the "/dev/mtdrX" devices support is need, |