Commit cd621274 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse

mtd: do not use mtd->get_unmapped_area directly

Remove direct usage of mtd->get_unmapped_area. Instead, just call
'mtd_get_unmapped_area()' which will return -EOPNOTSUPP if the function
is not implemented and test for this error code.
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 10934478
...@@ -1124,9 +1124,8 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, ...@@ -1124,9 +1124,8 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file,
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
if (mtd->get_unmapped_area) {
unsigned long offset; unsigned long offset;
int ret;
if (addr != 0) if (addr != 0)
return (unsigned long) -EINVAL; return (unsigned long) -EINVAL;
...@@ -1138,11 +1137,8 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file, ...@@ -1138,11 +1137,8 @@ static unsigned long mtdchar_get_unmapped_area(struct file *file,
if (offset > mtd->size - len) if (offset > mtd->size - len)
return (unsigned long) -EINVAL; return (unsigned long) -EINVAL;
return mtd_get_unmapped_area(mtd, len, offset, flags); ret = mtd_get_unmapped_area(mtd, len, offset, flags);
} return ret == -EOPNOTSUPP ? -ENOSYS : ret;
/* can't map directly */
return (unsigned long) -ENOSYS;
} }
#endif #endif
......
...@@ -726,11 +726,7 @@ static unsigned long concat_get_unmapped_area(struct mtd_info *mtd, ...@@ -726,11 +726,7 @@ static unsigned long concat_get_unmapped_area(struct mtd_info *mtd,
if (offset + len > subdev->size) if (offset + len > subdev->size)
return (unsigned long) -EINVAL; return (unsigned long) -EINVAL;
if (subdev->get_unmapped_area) return mtd_get_unmapped_area(subdev, len, offset, flags);
return mtd_get_unmapped_area(subdev, len, offset,
flags);
break;
} }
return (unsigned long) -ENOSYS; return (unsigned long) -ENOSYS;
......
...@@ -280,6 +280,8 @@ static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd, ...@@ -280,6 +280,8 @@ static inline unsigned long mtd_get_unmapped_area(struct mtd_info *mtd,
unsigned long offset, unsigned long offset,
unsigned long flags) unsigned long flags)
{ {
if (!mtd->get_unmapped_area)
return -EOPNOTSUPP;
return mtd->get_unmapped_area(mtd, len, offset, flags); return mtd->get_unmapped_area(mtd, len, offset, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment