Commit 079c985e7a6f4ce60f931cebfdd5ee3c38347e31
Committed by
David Woodhouse
1 parent
381345652f
Exists in
master
and in
6 other branches
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>
Showing 4 changed files with 9 additions and 11 deletions Side-by-side Diff
drivers/mtd/maps/physmap.c
... | ... | @@ -190,9 +190,8 @@ |
190 | 190 | int i; |
191 | 191 | |
192 | 192 | for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++) |
193 | - if (info->mtd[i]->suspend && info->mtd[i]->resume) | |
194 | - if (mtd_suspend(info->mtd[i]) == 0) | |
195 | - mtd_resume(info->mtd[i]); | |
193 | + if (mtd_suspend(info->mtd[i]) == 0) | |
194 | + mtd_resume(info->mtd[i]); | |
196 | 195 | } |
197 | 196 | #else |
198 | 197 | #define physmap_flash_shutdown NULL |
drivers/mtd/maps/rbtx4939-flash.c
... | ... | @@ -119,9 +119,8 @@ |
119 | 119 | { |
120 | 120 | struct rbtx4939_flash_info *info = platform_get_drvdata(dev); |
121 | 121 | |
122 | - if (info->mtd->suspend && info->mtd->resume) | |
123 | - if (mtd_suspend(info->mtd) == 0) | |
124 | - mtd_resume(info->mtd); | |
122 | + if (mtd_suspend(info->mtd) == 0) | |
123 | + mtd_resume(info->mtd); | |
125 | 124 | } |
126 | 125 | #else |
127 | 126 | #define rbtx4939_flash_shutdown NULL |
drivers/mtd/mtdcore.c
include/linux/mtd/mtd.h
... | ... | @@ -427,12 +427,15 @@ |
427 | 427 | |
428 | 428 | static inline int mtd_suspend(struct mtd_info *mtd) |
429 | 429 | { |
430 | + if (!mtd->suspend) | |
431 | + return -EOPNOTSUPP; | |
430 | 432 | return mtd->suspend(mtd); |
431 | 433 | } |
432 | 434 | |
433 | 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 | 441 | static inline int mtd_block_isbad(struct mtd_info *mtd, loff_t ofs) |