mtd: do not use mtd->lock, unlock and is_locked directly

Instead, call the corresponding MTD API function which will return
'-EOPNOTSUPP' if the operation is not supported.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
Artem Bityutskiy
2011-12-30 17:00:35 +02:00
committed by David Woodhouse
parent 327cf2922b
commit 381345652f
5 changed files with 19 additions and 29 deletions

View File

@@ -814,10 +814,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&einfo, argp, sizeof(einfo)))
return -EFAULT;
if (!mtd->lock)
ret = -EOPNOTSUPP;
else
ret = mtd_lock(mtd, einfo.start, einfo.length);
ret = mtd_lock(mtd, einfo.start, einfo.length);
break;
}
@@ -828,10 +825,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&einfo, argp, sizeof(einfo)))
return -EFAULT;
if (!mtd->unlock)
ret = -EOPNOTSUPP;
else
ret = mtd_unlock(mtd, einfo.start, einfo.length);
ret = mtd_unlock(mtd, einfo.start, einfo.length);
break;
}
@@ -842,10 +836,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&einfo, argp, sizeof(einfo)))
return -EFAULT;
if (!mtd->is_locked)
ret = -EOPNOTSUPP;
else
ret = mtd_is_locked(mtd, einfo.start, einfo.length);
ret = mtd_is_locked(mtd, einfo.start, einfo.length);
break;
}