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>
int i;
for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
- if (info->mtd[i]->suspend && info->mtd[i]->resume)
- if (mtd_suspend(info->mtd[i]) == 0)
- mtd_resume(info->mtd[i]);
+ if (mtd_suspend(info->mtd[i]) == 0)
+ mtd_resume(info->mtd[i]);
}
#else
#define physmap_flash_shutdown NULL
{
struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
- if (info->mtd->suspend && info->mtd->resume)
- if (mtd_suspend(info->mtd) == 0)
- mtd_resume(info->mtd);
+ if (mtd_suspend(info->mtd) == 0)
+ mtd_resume(info->mtd);
}
#else
#define rbtx4939_flash_shutdown NULL
{
struct mtd_info *mtd = dev_get_drvdata(dev);
- if (mtd && mtd->suspend)
- return mtd_suspend(mtd);
- else
- return 0;
+ return mtd_suspend(mtd);
}
static int mtd_cls_resume(struct device *dev)
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)