]> err.no Git - linux-2.6/blobdiff - kernel/power/swsusp.c
[ARM] 3981/1: sched_clock for PXA2xx
[linux-2.6] / kernel / power / swsusp.c
index f9238faf76e4e5308a25c28dfb07970b5ce74d04..0b66659dc516f13eed980412dc196781ffa6892e 100644 (file)
@@ -67,9 +67,9 @@ unsigned int count_highmem_pages(void);
 int save_highmem(void);
 int restore_highmem(void);
 #else
-static int save_highmem(void) { return 0; }
-static int restore_highmem(void) { return 0; }
-static unsigned int count_highmem_pages(void) { return 0; }
+static inline int save_highmem(void) { return 0; }
+static inline int restore_highmem(void) { return 0; }
+static inline unsigned int count_highmem_pages(void) { return 0; }
 #endif
 
 /**
@@ -193,13 +193,14 @@ int swsusp_shrink_memory(void)
        printk("Shrinking memory...  ");
        do {
                size = 2 * count_highmem_pages();
-               size += size / 50 + count_data_pages();
-               size += (size + PBES_PER_PAGE - 1) / PBES_PER_PAGE +
-                       PAGES_FOR_IO;
+               size += size / 50 + count_data_pages() + PAGES_FOR_IO;
                tmp = size;
                for_each_zone (zone)
-                       if (!is_highmem(zone))
+                       if (!is_highmem(zone) && populated_zone(zone)) {
                                tmp -= zone->free_pages;
+                               tmp += zone->lowmem_reserve[ZONE_NORMAL];
+                               tmp += snapshot_additional_pages(zone);
+                       }
                if (tmp > 0) {
                        tmp = __shrink_memory(tmp);
                        if (!tmp)
@@ -246,6 +247,9 @@ int swsusp_suspend(void)
        restore_processor_state();
 Restore_highmem:
        restore_highmem();
+       /* NOTE:  device_power_up() is just a resume() for devices
+        * that suspended with irqs off ... no overall powerup.
+        */
        device_power_up();
 Enable_irqs:
        local_irq_enable();
@@ -255,8 +259,12 @@ Enable_irqs:
 int swsusp_resume(void)
 {
        int error;
+
        local_irq_disable();
-       if (device_power_down(PMSG_FREEZE))
+       /* NOTE:  device_power_down() is just a suspend() with irqs off;
+        * it has no special "power things down" semantics
+        */
+       if (device_power_down(PMSG_PRETHAW))
                printk(KERN_ERR "Some devices failed to power down, very bad\n");
        /* We'll ignore saved state, but this gets preempt count (etc) right */
        save_processor_state();