]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[MTD] physmap: add power management support
authorLennert Buytenhek <buytenh@wantstofly.org>
Thu, 21 Sep 2006 21:16:48 +0000 (23:16 +0200)
committerDavid Woodhouse <dwmw2@infradead.org>
Fri, 22 Sep 2006 09:26:56 +0000 (10:26 +0100)
Implement PM handling for physmap.  Idea from Steven Scholz, patch
by David Anders.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
drivers/mtd/maps/physmap.c

index 7799a25a7f2ae9c55242b6e83682e19b3981723c..bc7cc71788bc27be9ba18a778b3ee35426f76427 100644 (file)
@@ -158,9 +158,42 @@ err_out:
        return err;
 }
 
+#ifdef CONFIG_PM
+static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state)
+{
+       struct physmap_flash_info *info = platform_get_drvdata(dev);
+       int ret = 0;
+
+       if (info)
+               ret = info->mtd->suspend(info->mtd);
+
+       return ret;
+}
+
+static int physmap_flash_resume(struct platform_device *dev)
+{
+       struct physmap_flash_info *info = platform_get_drvdata(dev);
+       if (info)
+               info->mtd->resume(info->mtd);
+       return 0;
+}
+
+static void physmap_flash_shutdown(struct platform_device *dev)
+{
+       struct physmap_flash_info *info = platform_get_drvdata(dev);
+       if (info && info->mtd->suspend(info->mtd) == 0)
+               info->mtd->resume(info->mtd);
+}
+#endif
+
 static struct platform_driver physmap_flash_driver = {
        .probe          = physmap_flash_probe,
        .remove         = physmap_flash_remove,
+#ifdef CONFIG_PM
+       .suspend        = physmap_flash_suspend,
+       .resume         = physmap_flash_resume,
+       .shutdown       = physmap_flash_shutdown,
+#endif
        .driver         = {
                .name   = "physmap-flash",
        },