]> err.no Git - linux-2.6/blobdiff - drivers/mtd/maps/physmap.c
Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6] / drivers / mtd / maps / physmap.c
index 1f6b9066b63ee6d2495586318fdc8a1f6dfa33c5..42d844f8f6bfef79bdfef42ed48b33368ac4ecd0 100644 (file)
@@ -201,7 +201,19 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
        int i;
 
        for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-               ret |= info->mtd[i]->suspend(info->mtd[i]);
+               if (info->mtd[i]->suspend) {
+                       ret = info->mtd[i]->suspend(info->mtd[i]);
+                       if (ret)
+                               goto fail;
+               }
+
+       return 0;
+fail:
+       for (--i; i >= 0; --i)
+               if (info->mtd[i]->suspend) {
+                       BUG_ON(!info->mtd[i]->resume);
+                       info->mtd[i]->resume(info->mtd[i]);
+               }
 
        return ret;
 }
@@ -212,7 +224,8 @@ static int physmap_flash_resume(struct platform_device *dev)
        int i;
 
        for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
-               info->mtd[i]->resume(info->mtd[i]);
+               if (info->mtd[i]->resume)
+                       info->mtd[i]->resume(info->mtd[i]);
 
        return 0;
 }
@@ -223,8 +236,9 @@ 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]) == 0)
-                       info->mtd[i]->resume(info->mtd[i]);
+               if (info->mtd[i]->suspend && info->mtd[i]->resume)
+                       if (info->mtd[i]->suspend(info->mtd[i]) == 0)
+                               info->mtd[i]->resume(info->mtd[i]);
 }
 #else
 #define physmap_flash_suspend NULL