]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
mtd: do not use mtd->suspend and mtd->resume directly
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Fri, 30 Dec 2011 15:15:59 +0000 (17:15 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Mon, 9 Jan 2012 18:26:23 +0000 (18:26 +0000)
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>
drivers/mtd/maps/physmap.c
drivers/mtd/maps/rbtx4939-flash.c
drivers/mtd/mtdcore.c
include/linux/mtd/mtd.h

index d94cc62186c15cf83993fa7130fb9d03728bd3d1..abc562653b31777d4ea6d4217335d14b64ec8b15 100644 (file)
@@ -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
index 7176283120400b8e736320e37cf56d657f295d78..3da63fc6f16eb4faf522fdaa5b230b18c70c7354 100644 (file)
@@ -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
index 66494ee5355a9a857670a2eaa360b4b8f9311265..6ae9ca01388b76b06798749aba0a35cae34f8b9c 100644 (file)
@@ -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)
index 6c91ba59c229263cc55c611ae24ff363213fd37f..089370758fc9ca50bc355bff83c9a07dae3ed1ba 100644 (file)
@@ -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)