aboutsummaryrefslogtreecommitdiff
path: root/kernel/power
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/console.c16
-rw-r--r--kernel/power/disk.c15
-rw-r--r--kernel/power/main.c4
-rw-r--r--kernel/power/power.h15
-rw-r--r--kernel/power/snapshot.c4
-rw-r--r--kernel/power/swsusp.c18
6 files changed, 20 insertions, 52 deletions
diff --git a/kernel/power/console.c b/kernel/power/console.c
index 7ff375e7c95..623786d4415 100644
--- a/kernel/power/console.c
+++ b/kernel/power/console.c
@@ -9,18 +9,13 @@
#include <linux/console.h>
#include "power.h"
-static int new_loglevel = 10;
-static int orig_loglevel;
-#ifdef SUSPEND_CONSOLE
+#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
+
static int orig_fgconsole, orig_kmsg;
-#endif
int pm_prepare_console(void)
{
- orig_loglevel = console_loglevel;
- console_loglevel = new_loglevel;
-
-#ifdef SUSPEND_CONSOLE
acquire_console_sem();
orig_fgconsole = fg_console;
@@ -41,18 +36,15 @@ int pm_prepare_console(void)
}
orig_kmsg = kmsg_redirect;
kmsg_redirect = SUSPEND_CONSOLE;
-#endif
return 0;
}
void pm_restore_console(void)
{
- console_loglevel = orig_loglevel;
-#ifdef SUSPEND_CONSOLE
acquire_console_sem();
set_console(orig_fgconsole);
release_console_sem();
kmsg_redirect = orig_kmsg;
-#endif
return;
}
+#endif
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index e24446f8d8c..0b43847dc98 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -53,7 +53,7 @@ static void power_down(suspend_disk_method_t mode)
switch(mode) {
case PM_DISK_PLATFORM:
- kernel_power_off_prepare();
+ kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
error = pm_ops->enter(PM_SUSPEND_DISK);
break;
case PM_DISK_SHUTDOWN:
@@ -95,13 +95,6 @@ static int prepare_processes(void)
goto thaw;
}
- if (pm_disk_mode == PM_DISK_PLATFORM) {
- if (pm_ops && pm_ops->prepare) {
- if ((error = pm_ops->prepare(PM_SUSPEND_DISK)))
- goto thaw;
- }
- }
-
/* Free memory before shutting down devices. */
if (!(error = swsusp_shrink_memory()))
return 0;
@@ -367,14 +360,14 @@ power_attr(resume);
static ssize_t image_size_show(struct subsystem * subsys, char *buf)
{
- return sprintf(buf, "%u\n", image_size);
+ return sprintf(buf, "%lu\n", image_size);
}
static ssize_t image_size_store(struct subsystem * subsys, const char * buf, size_t n)
{
- unsigned int size;
+ unsigned long size;
- if (sscanf(buf, "%u", &size) == 1) {
+ if (sscanf(buf, "%lu", &size) == 1) {
image_size = size;
return n;
}
diff --git a/kernel/power/main.c b/kernel/power/main.c
index d253f3ae2fa..9cb235cba4a 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -133,10 +133,10 @@ static int suspend_enter(suspend_state_t state)
static void suspend_finish(suspend_state_t state)
{
device_resume();
- if (pm_ops && pm_ops->finish)
- pm_ops->finish(state);
thaw_processes();
enable_nonboot_cpus();
+ if (pm_ops && pm_ops->finish)
+ pm_ops->finish(state);
pm_restore_console();
}
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 7e8492fd142..388dba68084 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -1,14 +1,6 @@
#include <linux/suspend.h>
#include <linux/utsname.h>
-/* With SUSPEND_CONSOLE defined suspend looks *really* cool, but
- we probably do not take enough locks for switching consoles, etc,
- so bad things might happen.
-*/
-#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
-#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
-#endif
-
struct swsusp_info {
struct new_utsname uts;
u32 version_code;
@@ -42,17 +34,14 @@ static struct subsys_attribute _name##_attr = { \
extern struct subsystem power_subsys;
-extern int pm_prepare_console(void);
-extern void pm_restore_console(void);
-
/* References to section boundaries */
extern const void __nosave_begin, __nosave_end;
extern unsigned int nr_copy_pages;
extern struct pbe *pagedir_nosave;
-/* Preferred image size in MB (default 500) */
-extern unsigned int image_size;
+/* Preferred image size in bytes (default 500 MB) */
+extern unsigned long image_size;
extern asmlinkage int swsusp_arch_suspend(void);
extern asmlinkage int swsusp_arch_resume(void);
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 41f66365f0d..8d5a5986d62 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -91,10 +91,8 @@ static int save_highmem_zone(struct zone *zone)
* corrected eventually when the cases giving rise to this
* are better understood.
*/
- if (PageReserved(page)) {
- printk("highmem reserved page?!\n");
+ if (PageReserved(page))
continue;
- }
BUG_ON(PageNosave(page));
if (PageNosaveFree(page))
continue;
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 55a18d26abe..2d9d08f72f7 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -70,12 +70,12 @@
#include "power.h"
/*
- * Preferred image size in MB (tunable via /sys/power/image_size).
+ * Preferred image size in bytes (tunable via /sys/power/image_size).
* When it is set to N, swsusp will do its best to ensure the image
- * size will not exceed N MB, but if that is impossible, it will
+ * size will not exceed N bytes, but if that is impossible, it will
* try to create the smallest image possible.
*/
-unsigned int image_size = 500;
+unsigned long image_size = 500 * 1024 * 1024;
#ifdef CONFIG_HIGHMEM
unsigned int count_highmem_pages(void);
@@ -153,13 +153,11 @@ static int swsusp_swap_check(void) /* This is called before saving image */
{
int i;
- if (!swsusp_resume_device)
- return -ENODEV;
spin_lock(&swap_lock);
for (i = 0; i < MAX_SWAPFILES; i++) {
if (!(swap_info[i].flags & SWP_WRITEOK))
continue;
- if (is_resume_device(swap_info + i)) {
+ if (!swsusp_resume_device || is_resume_device(swap_info + i)) {
spin_unlock(&swap_lock);
root_swap = i;
return 0;
@@ -590,7 +588,7 @@ int swsusp_shrink_memory(void)
if (!tmp)
return -ENOMEM;
pages += tmp;
- } else if (size > (image_size * 1024 * 1024) / PAGE_SIZE) {
+ } else if (size > image_size / PAGE_SIZE) {
tmp = shrink_all_memory(SHRINK_BITE);
pages += tmp;
}
@@ -743,7 +741,6 @@ static int submit(int rw, pgoff_t page_off, void *page)
if (!bio)
return -ENOMEM;
bio->bi_sector = page_off * (PAGE_SIZE >> 9);
- bio_get(bio);
bio->bi_bdev = resume_bdev;
bio->bi_end_io = end_io;
@@ -753,14 +750,13 @@ static int submit(int rw, pgoff_t page_off, void *page)
goto Done;
}
- if (rw == WRITE)
- bio_set_pages_dirty(bio);
atomic_set(&io_done, 1);
submit_bio(rw | (1 << BIO_RW_SYNC), bio);
while (atomic_read(&io_done))
yield();
-
+ if (rw == READ)
+ bio_set_pages_dirty(bio);
Done:
bio_put(bio);
return error;