From de05bbdb1a6bf9758787fc2777a306e368954327 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 30 Dec 2011 17:15:59 +0200 Subject: [PATCH] --- yaml --- r: 282915 b: refs/heads/master c: 079c985e7a6f4ce60f931cebfdd5ee3c38347e31 h: refs/heads/master i: 282913: 0bdecada1db81e87c66d7bcc1a84f21a9d3f63b9 282911: 2820ab4b11c42af363a460b32b31a3dfc034b0e9 v: v3 --- [refs] | 2 +- trunk/drivers/mtd/maps/physmap.c | 5 ++--- trunk/drivers/mtd/maps/rbtx4939-flash.c | 5 ++--- trunk/drivers/mtd/mtdcore.c | 5 +---- trunk/include/linux/mtd/mtd.h | 5 ++++- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 190b5ab321b8..2d6dfe9d7616 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 381345652fca688aeaa967c231e5075cf68d05b6 +refs/heads/master: 079c985e7a6f4ce60f931cebfdd5ee3c38347e31 diff --git a/trunk/drivers/mtd/maps/physmap.c b/trunk/drivers/mtd/maps/physmap.c index d94cc62186c1..abc562653b31 100644 --- a/trunk/drivers/mtd/maps/physmap.c +++ b/trunk/drivers/mtd/maps/physmap.c @@ -190,9 +190,8 @@ static void physmap_flash_shutdown(struct platform_device *dev) 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 diff --git a/trunk/drivers/mtd/maps/rbtx4939-flash.c b/trunk/drivers/mtd/maps/rbtx4939-flash.c index 717628312040..3da63fc6f16e 100644 --- a/trunk/drivers/mtd/maps/rbtx4939-flash.c +++ b/trunk/drivers/mtd/maps/rbtx4939-flash.c @@ -119,9 +119,8 @@ static void rbtx4939_flash_shutdown(struct platform_device *dev) { 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 diff --git a/trunk/drivers/mtd/mtdcore.c b/trunk/drivers/mtd/mtdcore.c index 66494ee5355a..6ae9ca01388b 100644 --- a/trunk/drivers/mtd/mtdcore.c +++ b/trunk/drivers/mtd/mtdcore.c @@ -119,10 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state) { 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) diff --git a/trunk/include/linux/mtd/mtd.h b/trunk/include/linux/mtd/mtd.h index 6c91ba59c229..089370758fc9 100644 --- a/trunk/include/linux/mtd/mtd.h +++ b/trunk/include/linux/mtd/mtd.h @@ -427,12 +427,15 @@ 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) { + 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)