summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/build.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2016-03-24 14:43:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-03-27 23:49:12 -0400
commit87f15d4add758fb7fc76655721af94be57a4c17d (patch)
treea5e6d2048e83797da89ac23a22280bd2b37c05c9 /drivers/mtd/ubi/build.c
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
downloadop-kernel-dev-87f15d4add758fb7fc76655721af94be57a4c17d.zip
op-kernel-dev-87f15d4add758fb7fc76655721af94be57a4c17d.tar.gz
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/ubi/build.c')
-rw-r--r--drivers/mtd/ubi/build.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 22fd19c..a7d1feb 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)
*/
static struct mtd_info * __init open_mtd_by_chdev(const char *mtd_dev)
{
- int err, major, minor, mode;
- struct path path;
+ struct kstat stat;
+ int err, minor;
/* Probably this is an MTD character device node path */
- err = kern_path(mtd_dev, LOOKUP_FOLLOW, &path);
+ err = vfs_stat(mtd_dev, &stat);
if (err)
return ERR_PTR(err);
/* MTD device number is defined by the major / minor numbers */
- major = imajor(d_backing_inode(path.dentry));
- minor = iminor(d_backing_inode(path.dentry));
- mode = d_backing_inode(path.dentry)->i_mode;
- path_put(&path);
- if (major != MTD_CHAR_MAJOR || !S_ISCHR(mode))
+ if (MAJOR(stat.rdev) != MTD_CHAR_MAJOR || !S_ISCHR(stat.mode))
return ERR_PTR(-EINVAL);
+ minor = MINOR(stat.rdev);
if (minor & 1)
/*
* Just do not think the "/dev/mtdrX" devices support is need,
OpenPOWER on IntegriCloud