]> err.no Git - linux-2.6/blobdiff - drivers/mtd/maps/physmap.c
Merge git://git.infradead.org/embedded-2.6
[linux-2.6] / drivers / mtd / maps / physmap.c
index f00e04efbe2898db97673008c90f5faea20e1fa6..183255fcfdcbd288dc38e697b6a6ed8ff3be3321 100644 (file)
@@ -202,9 +202,8 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state
        int ret = 0;
        int i;
 
-       if (info)
-               for (i = 0; i < MAX_RESOURCES; i++)
-                       ret |= info->mtd[i]->suspend(info->mtd[i]);
+       for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
+               ret |= info->mtd[i]->suspend(info->mtd[i]);
 
        return ret;
 }
@@ -214,9 +213,9 @@ static int physmap_flash_resume(struct platform_device *dev)
        struct physmap_flash_info *info = platform_get_drvdata(dev);
        int i;
 
-       if (info)
-               for (i = 0; i < MAX_RESOURCES; i++)
-                       info->mtd[i]->resume(info->mtd[i]);
+       for (i = 0; i < MAX_RESOURCES && info->mtd[i]; i++)
+               info->mtd[i]->resume(info->mtd[i]);
+
        return 0;
 }
 
@@ -225,8 +224,8 @@ static void physmap_flash_shutdown(struct platform_device *dev)
        struct physmap_flash_info *info = platform_get_drvdata(dev);
        int i;
 
-       for (i = 0; i < MAX_RESOURCES; i++)
-               if (info && info->mtd[i]->suspend(info->mtd[i]) == 0)
+       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]);
 }
 #else
@@ -243,6 +242,7 @@ static struct platform_driver physmap_flash_driver = {
        .shutdown       = physmap_flash_shutdown,
        .driver         = {
                .name   = "physmap-flash",
+               .owner  = THIS_MODULE,
        },
 };
 
@@ -320,3 +320,10 @@ module_exit(physmap_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
 MODULE_DESCRIPTION("Generic configurable MTD map driver");
+
+/* legacy platform drivers can't hotplug or coldplg */
+#ifndef PHYSMAP_COMPAT
+/* work with hotplug and coldplug */
+MODULE_ALIAS("platform:physmap-flash");
+#endif
+