diff options
Diffstat (limited to 'kernel/power')
| -rw-r--r-- | kernel/power/console.c | 63 | ||||
| -rw-r--r-- | kernel/power/process.c | 1 | ||||
| -rw-r--r-- | kernel/power/snapshot.c | 2 | ||||
| -rw-r--r-- | kernel/power/swap.c | 1 |
4 files changed, 7 insertions, 60 deletions
diff --git a/kernel/power/console.c b/kernel/power/console.c index a3961b205de7..5187136fe1de 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c | |||
| @@ -14,56 +14,13 @@ | |||
| 14 | #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) | 14 | #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) |
| 15 | 15 | ||
| 16 | static int orig_fgconsole, orig_kmsg; | 16 | static int orig_fgconsole, orig_kmsg; |
| 17 | static int disable_vt_switch; | ||
| 18 | |||
| 19 | /* | ||
| 20 | * Normally during a suspend, we allocate a new console and switch to it. | ||
| 21 | * When we resume, we switch back to the original console. This switch | ||
| 22 | * can be slow, so on systems where the framebuffer can handle restoration | ||
| 23 | * of video registers anyways, there's little point in doing the console | ||
| 24 | * switch. This function allows you to disable it by passing it '0'. | ||
| 25 | */ | ||
| 26 | void pm_set_vt_switch(int do_switch) | ||
| 27 | { | ||
| 28 | acquire_console_sem(); | ||
| 29 | disable_vt_switch = !do_switch; | ||
| 30 | release_console_sem(); | ||
| 31 | } | ||
| 32 | EXPORT_SYMBOL(pm_set_vt_switch); | ||
| 33 | 17 | ||
| 34 | int pm_prepare_console(void) | 18 | int pm_prepare_console(void) |
| 35 | { | 19 | { |
| 36 | acquire_console_sem(); | 20 | orig_fgconsole = vt_move_to_console(SUSPEND_CONSOLE, 1); |
| 37 | 21 | if (orig_fgconsole < 0) | |
| 38 | if (disable_vt_switch) { | ||
| 39 | release_console_sem(); | ||
| 40 | return 0; | ||
| 41 | } | ||
| 42 | |||
| 43 | orig_fgconsole = fg_console; | ||
| 44 | |||
| 45 | if (vc_allocate(SUSPEND_CONSOLE)) { | ||
| 46 | /* we can't have a free VC for now. Too bad, | ||
| 47 | * we don't want to mess the screen for now. */ | ||
| 48 | release_console_sem(); | ||
| 49 | return 1; | 22 | return 1; |
| 50 | } | ||
| 51 | 23 | ||
| 52 | if (set_console(SUSPEND_CONSOLE)) { | ||
| 53 | /* | ||
| 54 | * We're unable to switch to the SUSPEND_CONSOLE. | ||
| 55 | * Let the calling function know so it can decide | ||
| 56 | * what to do. | ||
| 57 | */ | ||
| 58 | release_console_sem(); | ||
| 59 | return 1; | ||
| 60 | } | ||
| 61 | release_console_sem(); | ||
| 62 | |||
| 63 | if (vt_waitactive(SUSPEND_CONSOLE)) { | ||
| 64 | pr_debug("Suspend: Can't switch VCs."); | ||
| 65 | return 1; | ||
| 66 | } | ||
| 67 | orig_kmsg = kmsg_redirect; | 24 | orig_kmsg = kmsg_redirect; |
| 68 | kmsg_redirect = SUSPEND_CONSOLE; | 25 | kmsg_redirect = SUSPEND_CONSOLE; |
| 69 | return 0; | 26 | return 0; |
| @@ -71,19 +28,9 @@ int pm_prepare_console(void) | |||
| 71 | 28 | ||
| 72 | void pm_restore_console(void) | 29 | void pm_restore_console(void) |
| 73 | { | 30 | { |
| 74 | acquire_console_sem(); | 31 | if (orig_fgconsole >= 0) { |
| 75 | if (disable_vt_switch) { | 32 | vt_move_to_console(orig_fgconsole, 0); |
| 76 | release_console_sem(); | 33 | kmsg_redirect = orig_kmsg; |
| 77 | return; | ||
| 78 | } | ||
| 79 | set_console(orig_fgconsole); | ||
| 80 | release_console_sem(); | ||
| 81 | |||
| 82 | if (vt_waitactive(orig_fgconsole)) { | ||
| 83 | pr_debug("Resume: Can't switch VCs."); | ||
| 84 | return; | ||
| 85 | } | 34 | } |
| 86 | |||
| 87 | kmsg_redirect = orig_kmsg; | ||
| 88 | } | 35 | } |
| 89 | #endif | 36 | #endif |
diff --git a/kernel/power/process.c b/kernel/power/process.c index da2072d73811..cc2e55373b68 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #undef DEBUG | 9 | #undef DEBUG |
| 10 | 10 | ||
| 11 | #include <linux/interrupt.h> | 11 | #include <linux/interrupt.h> |
| 12 | #include <linux/oom.h> | ||
| 12 | #include <linux/suspend.h> | 13 | #include <linux/suspend.h> |
| 13 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 14 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 97955b0e44f4..36cb168e4330 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c | |||
| @@ -619,7 +619,7 @@ __register_nosave_region(unsigned long start_pfn, unsigned long end_pfn, | |||
| 619 | BUG_ON(!region); | 619 | BUG_ON(!region); |
| 620 | } else | 620 | } else |
| 621 | /* This allocation cannot fail */ | 621 | /* This allocation cannot fail */ |
| 622 | region = alloc_bootmem_low(sizeof(struct nosave_region)); | 622 | region = alloc_bootmem(sizeof(struct nosave_region)); |
| 623 | region->start_pfn = start_pfn; | 623 | region->start_pfn = start_pfn; |
| 624 | region->end_pfn = end_pfn; | 624 | region->end_pfn = end_pfn; |
| 625 | list_add_tail(®ion->list, &nosave_regions); | 625 | list_add_tail(®ion->list, &nosave_regions); |
diff --git a/kernel/power/swap.c b/kernel/power/swap.c index 8ba052c86d48..b101cdc4df3f 100644 --- a/kernel/power/swap.c +++ b/kernel/power/swap.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/file.h> | 15 | #include <linux/file.h> |
| 16 | #include <linux/utsname.h> | ||
| 17 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| 18 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
| 19 | #include <linux/genhd.h> | 18 | #include <linux/genhd.h> |
