aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2005-09-03 18:57:05 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:06:17 -0400
commit99dc7d63e0dcb457580241055b2a39d011309db8 (patch)
tree3be63831f5fa823ef7e5c99339e9a71c29d3ad08 /kernel/power/swsusp.c
parentdd5d666b7995e542b7f81a4bb1c7ad634f4f6c51 (diff)
[PATCH] swsusp: fix error handling and cleanups
Drop printing during normal boot (when no image exists in swap), print message when drivers fail, fix error paths and consolidate near-identical functions in disk.c (and functions with just one statement). Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/swsusp.c')
-rw-r--r--kernel/power/swsusp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 1681e8a3fe51..eaacd5cb5889 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -530,7 +530,6 @@ static int write_pagedir(void)
530 * write_suspend_image - Write entire image and metadata. 530 * write_suspend_image - Write entire image and metadata.
531 * 531 *
532 */ 532 */
533
534static int write_suspend_image(void) 533static int write_suspend_image(void)
535{ 534{
536 int error; 535 int error;
@@ -1021,20 +1020,21 @@ int swsusp_suspend(void)
1021 * at resume time, and evil weirdness ensues. 1020 * at resume time, and evil weirdness ensues.
1022 */ 1021 */
1023 if ((error = device_power_down(PMSG_FREEZE))) { 1022 if ((error = device_power_down(PMSG_FREEZE))) {
1023 printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
1024 local_irq_enable(); 1024 local_irq_enable();
1025 return error; 1025 return error;
1026 } 1026 }
1027 1027
1028 if ((error = swsusp_swap_check())) { 1028 if ((error = swsusp_swap_check())) {
1029 printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try " 1029 printk(KERN_ERR "swsusp: cannot find swap device, try swapon -a.\n");
1030 "swapon -a!\n"); 1030 device_power_up();
1031 local_irq_enable(); 1031 local_irq_enable();
1032 return error; 1032 return error;
1033 } 1033 }
1034 1034
1035 save_processor_state(); 1035 save_processor_state();
1036 if ((error = swsusp_arch_suspend())) 1036 if ((error = swsusp_arch_suspend()))
1037 printk("Error %d suspending\n", error); 1037 printk(KERN_ERR "Error %d suspending\n", error);
1038 /* Restore control flow magically appears here */ 1038 /* Restore control flow magically appears here */
1039 restore_processor_state(); 1039 restore_processor_state();
1040 BUG_ON (nr_copy_pages_check != nr_copy_pages); 1040 BUG_ON (nr_copy_pages_check != nr_copy_pages);
@@ -1314,7 +1314,8 @@ static const char * sanity_check(void)
1314 if (strcmp(swsusp_info.uts.machine,system_utsname.machine)) 1314 if (strcmp(swsusp_info.uts.machine,system_utsname.machine))
1315 return "machine"; 1315 return "machine";
1316#if 0 1316#if 0
1317 if(swsusp_info.cpus != num_online_cpus()) 1317 /* We can't use number of online CPUs when we use hotplug to remove them ;-))) */
1318 if (swsusp_info.cpus != num_possible_cpus())
1318 return "number of cpus"; 1319 return "number of cpus";
1319#endif 1320#endif
1320 return NULL; 1321 return NULL;
@@ -1355,7 +1356,6 @@ static int check_sig(void)
1355 */ 1356 */
1356 error = bio_write_page(0, &swsusp_header); 1357 error = bio_write_page(0, &swsusp_header);
1357 } else { 1358 } else {
1358 printk(KERN_ERR "swsusp: Suspend partition has wrong signature?\n");
1359 return -EINVAL; 1359 return -EINVAL;
1360 } 1360 }
1361 if (!error) 1361 if (!error)