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

@ -406,16 +406,22 @@ static inline void mtd_sync(struct mtd_info *mtd)
/* Chip-supported device locking */
static inline int mtd_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
if (!mtd->lock)
return -EOPNOTSUPP;
return mtd->lock(mtd, ofs, len);
}
static inline int mtd_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
if (!mtd->unlock)
return -EOPNOTSUPP;
return mtd->unlock(mtd, ofs, len);
}
static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
{
if (!mtd->is_locked)
return -EOPNOTSUPP;
return mtd->is_locked(mtd, ofs, len);
}