Merge master.kernel.org:/home/rmk/linux-2.6-arm
[powerpc.git] / drivers / mtd / maps / sa1100-flash.c
index acf01ef..9e8bb17 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * Flash memory access on SA11x0 based devices
- * 
+ *
  * (C) 2000 Nicolas Pitre <nico@cam.org>
- * 
- * $Id: sa1100-flash.c,v 1.47 2004/11/01 13:44:36 rmk Exp $
+ *
+ * $Id: sa1100-flash.c,v 1.51 2005/11/07 11:14:28 gleixner Exp $
  */
 #include <linux/config.h>
 #include <linux/module.h>
@@ -13,7 +13,7 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/err.h>
 
 #include <linux/mtd/mtd.h>
@@ -241,8 +241,7 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla
 #endif
        }
 
-       if (info->parts)
-               kfree(info->parts);
+       kfree(info->parts);
 
        for (i = info->num_subdev - 1; i >= 0; i--)
                sa1100_destroy_subdev(&info->subdev[i]);
@@ -440,9 +439,17 @@ static int sa1100_mtd_resume(struct device *dev)
                info->mtd->resume(info->mtd);
        return 0;
 }
+
+static void sa1100_mtd_shutdown(struct device *dev)
+{
+       struct sa_info *info = dev_get_drvdata(dev);
+       if (info && info->mtd->suspend(info->mtd) == 0)
+               info->mtd->resume(info->mtd);
+}
 #else
 #define sa1100_mtd_suspend NULL
 #define sa1100_mtd_resume  NULL
+#define sa1100_mtd_shutdown NULL
 #endif
 
 static struct device_driver sa1100_mtd_driver = {
@@ -452,6 +459,7 @@ static struct device_driver sa1100_mtd_driver = {
        .remove         = __exit_p(sa1100_mtd_remove),
        .suspend        = sa1100_mtd_suspend,
        .resume         = sa1100_mtd_resume,
+       .shutdown       = sa1100_mtd_shutdown,
 };
 
 static int __init sa1100_mtd_init(void)