This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / kernel / power / disk.c
index 0f5dc71..312aa16 100644 (file)
@@ -3,7 +3,6 @@
  *
  * Copyright (c) 2003 Patrick Mochel
  * Copyright (c) 2003 Open Source Development Lab
- * Copyright (c) 2004 Pavel Machek <pavel@suse.cz>
  *
  * This file is released under the GPLv2.
  *
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/fs.h>
-#include <linux/device.h>
 #include "power.h"
 
 
-extern suspend_disk_method_t pm_disk_mode;
+extern u32 pm_disk_mode;
 extern struct pm_ops * pm_ops;
 
 extern int swsusp_suspend(void);
@@ -43,7 +41,7 @@ char resume_file[256] = CONFIG_PM_STD_PARTITION;
  *     there ain't no turning back.
  */
 
-static void power_down(suspend_disk_method_t mode)
+static int power_down(u32 mode)
 {
        unsigned long flags;
        int error = 0;
@@ -69,6 +67,7 @@ static void power_down(suspend_disk_method_t mode)
           after resume. */
        printk(KERN_CRIT "Please power me down manually\n");
        while(1);
+       return 0;
 }
 
 
@@ -86,20 +85,10 @@ static int in_suspend __nosavedata = 0;
 
 static void free_some_memory(void)
 {
-       unsigned int i = 0;
-       unsigned int tmp;
-       unsigned long pages = 0;
-       char *p = "-\\|/";
-
-       printk("Freeing memory...  ");
-       while ((tmp = shrink_all_memory(10000))) {
-               pages += tmp;
-               printk("\b%c", p[i]);
-               i++;
-               if (i > 3)
-                       i = 0;
-       }
-       printk("\bdone (%li pages freed)\n", pages);
+       printk("Freeing memory: ");
+       while (shrink_all_memory(10000))
+               printk(".");
+       printk("|\n");
 }
 
 
@@ -163,7 +152,7 @@ static int prepare(void)
  *
  *     If we're going through the firmware, then get it over with quickly.
  *
- *     If not, then call swsusp to do it's thing, then figure out how
+ *     If not, then call pmdis to do it's thing, then figure out how
  *     to power down the system.
  */
 
@@ -185,9 +174,18 @@ int pm_suspend_disk(void)
 
        if (in_suspend) {
                pr_debug("PM: writing image.\n");
+
+               /*
+                * FIXME: Leftover from swsusp. Are they necessary?
+                */
+               mb();
+               barrier();
+
                error = swsusp_write();
-               if (!error)
-                       power_down(pm_disk_mode);
+               if (!error) {
+                       error = power_down(pm_disk_mode);
+                       pr_debug("PM: Power down failed.\n");
+               }
        } else
                pr_debug("PM: Image restored successfully.\n");
        swsusp_free();
@@ -294,7 +292,7 @@ static ssize_t disk_store(struct subsystem * s, const char * buf, size_t n)
        int i;
        int len;
        char *p;
-       suspend_disk_method_t mode = 0;
+       u32 mode = 0;
 
        p = memchr(buf, '\n', n);
        len = p ? p - buf : n;