summaryrefslogtreecommitdiff
path: root/include/linux/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2011-12-30 17:00:35 +0200
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 18:26:22 +0000
commit381345652fca688aeaa967c231e5075cf68d05b6 (patch)
tree5f23ecdd28165d15109c6fd7ad0c4c573f094707 /include/linux/mtd
parent327cf2922b4edf0439b219469722d2a502e37349 (diff)
downloadlwn-381345652fca688aeaa967c231e5075cf68d05b6.tar.gz
lwn-381345652fca688aeaa967c231e5075cf68d05b6.zip
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>
Diffstat (limited to 'include/linux/mtd')
-rw-r--r--include/linux/mtd/mtd.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 305f12b940f4..6c91ba59c229 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -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);
}