]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mtd/maps/physmap.c
memory hotplug: fix page_zone() calculation in test_pages_isolated()
[linux-2.6-omap-h63xx.git] / drivers / mtd / maps / physmap.c
index 183255fcfdcbd288dc38e697b6a6ed8ff3be3321..42d844f8f6bfef79bdfef42ed48b33368ac4ecd0 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * $Id: physmap.c,v 1.39 2005/11/29 14:49:36 gleixner Exp $
- *
  * Normal mappings of chips in physical memory
  *
  * Copyright (C) 2003 MontaVista Software Inc.
@@ -203,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;
 }
@@ -214,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;
 }
@@ -225,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