diff options
-rw-r--r-- | drivers/mtd/maps/physmap.c | 5 | ||||
-rw-r--r-- | drivers/mtd/maps/rbtx4939-flash.c | 5 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 5 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 5 |
4 files changed, 9 insertions, 11 deletions
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index d94cc62186c1..abc562653b31 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -190,9 +190,8 @@ static void physmap_flash_shutdown(struct platform_device *dev) | |||
190 | int i; | 190 | int i; |
191 | 191 | ||
192 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) | 192 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
193 | if (info->mtd[i]->suspend && info->mtd[i]->resume) | 193 | if (mtd_suspend(info->mtd[i]) == 0) |
194 | if (mtd_suspend(info->mtd[i]) == 0) | 194 | mtd_resume(info->mtd[i]); |
195 | mtd_resume(info->mtd[i]); | ||
196 | } | 195 | } |
197 | #else | 196 | #else |
198 | #define physmap_flash_shutdown NULL | 197 | #define physmap_flash_shutdown NULL |
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index 717628312040..3da63fc6f16e 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
@@ -119,9 +119,8 @@ static void rbtx4939_flash_shutdown(struct platform_device *dev) | |||
119 | { | 119 | { |
120 | struct rbtx4939_flash_info *info = platform_get_drvdata(dev); | 120 | struct rbtx4939_flash_info *info = platform_get_drvdata(dev); |
121 | 121 | ||
122 | if (info->mtd->suspend && info->mtd->resume) | 122 | if (mtd_suspend(info->mtd) == 0) |
123 | if (mtd_suspend(info->mtd) == 0) | 123 | mtd_resume(info->mtd); |
124 | mtd_resume(info->mtd); | ||
125 | } | 124 | } |
126 | #else | 125 | #else |
127 | #define rbtx4939_flash_shutdown NULL | 126 | #define rbtx4939_flash_shutdown NULL |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 66494ee5355a..6ae9ca01388b 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -119,10 +119,7 @@ static int mtd_cls_suspend(struct device *dev, pm_message_t state) | |||
119 | { | 119 | { |
120 | struct mtd_info *mtd = dev_get_drvdata(dev); | 120 | struct mtd_info *mtd = dev_get_drvdata(dev); |
121 | 121 | ||
122 | if (mtd && mtd->suspend) | 122 | return mtd_suspend(mtd); |
123 | return mtd_suspend(mtd); | ||
124 | else | ||
125 | return 0; | ||
126 | } | 123 | } |
127 | 124 | ||
128 | static int mtd_cls_resume(struct device *dev) | 125 | static int mtd_cls_resume(struct device *dev) |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 6c91ba59c229..089370758fc9 100644 --- a/include/linux/mtd/mtd.h +++ b/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) | |||
427 | 427 | ||
428 | static inline int mtd_suspend(struct mtd_info *mtd) | 428 | static inline int mtd_suspend(struct mtd_info *mtd) |
429 | { | 429 | { |
430 | if (!mtd->suspend) | ||
431 | return -EOPNOTSUPP; | ||
430 | return mtd->suspend(mtd); | 432 | return mtd->suspend(mtd); |
431 | } | 433 | } |
432 | 434 | ||
433 | static inline void mtd_resume(struct mtd_info *mtd) | 435 | static inline void mtd_resume(struct mtd_info *mtd) |
434 | { | 436 | { |
435 | mtd->resume(mtd); | 437 | if (mtd->resume) |
438 | mtd->resume(mtd); | ||
436 | } | 439 | } |
437 | 440 | ||
438 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) | 441 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) |