mtd: do not use mtd->suspend and mtd->resume directly
Just call the 'mtd_suspend()' and 'mtd_resume()' - they will do nothing
if the operation is not defined.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 6c91ba5..0893707 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -427,12 +427,15 @@
static inline int mtd_suspend(struct mtd_info *mtd)
{
+ if (!mtd->suspend)
+ return -EOPNOTSUPP;
return mtd->suspend(mtd);
}
static inline void mtd_resume(struct mtd_info *mtd)
{
- mtd->resume(mtd);
+ if (mtd->resume)
+ mtd->resume(mtd);
}
static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs)