Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 079c985e authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by David Woodhouse
Browse files

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: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 38134565
Loading
Loading
Loading
Loading
+2 −3
Original line number Original line Diff line number Diff line
@@ -190,7 +190,6 @@ static void physmap_flash_shutdown(struct platform_device *dev)
	int i;
	int i;


	for (i = 0; i < MAX_RESOURCES && info->mtd[i]; 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)
		if (mtd_suspend(info->mtd[i]) == 0)
			mtd_resume(info->mtd[i]);
			mtd_resume(info->mtd[i]);
}
}
+2 −3
Original line number Original line Diff line number Diff line
@@ -119,7 +119,6 @@ static void rbtx4939_flash_shutdown(struct platform_device *dev)
{
{
	struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
	struct rbtx4939_flash_info *info = platform_get_drvdata(dev);


	if (info->mtd->suspend && info->mtd->resume)
	if (mtd_suspend(info->mtd) == 0)
	if (mtd_suspend(info->mtd) == 0)
		mtd_resume(info->mtd);
		mtd_resume(info->mtd);
}
}
+1 −4
Original line number Original line Diff line number Diff line
@@ -119,10 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state)
{
{
	struct mtd_info *mtd = dev_get_drvdata(dev);
	struct mtd_info *mtd = dev_get_drvdata(dev);


	if (mtd && mtd->suspend)
	return mtd_suspend(mtd);
	return mtd_suspend(mtd);
	else
		return 0;
}
}


static int mtd_cls_resume(struct device *dev)
static int mtd_cls_resume(struct device *dev)
+4 −1
Original line number Original line Diff line number Diff line
@@ -427,11 +427,14 @@ static inline int mtd_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)


static inline int mtd_suspend(struct mtd_info *mtd)
static inline int mtd_suspend(struct mtd_info *mtd)
{
{
	if (!mtd->suspend)
		return -EOPNOTSUPP;
	return mtd->suspend(mtd);
	return mtd->suspend(mtd);
}
}


static inline void mtd_resume(struct mtd_info *mtd)
static inline void mtd_resume(struct mtd_info *mtd)
{
{
	if (mtd->resume)
		mtd->resume(mtd);
		mtd->resume(mtd);
}
}