aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/swsusp.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/swsusp.c')
-rw-r--r--kernel/power/swsusp.c33
1 files changed, 11 insertions, 22 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index c285fc5a2320..7d7801cd01f0 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -869,13 +869,6 @@ extern asmlinkage int swsusp_arch_resume(void);
869 869
870asmlinkage int swsusp_save(void) 870asmlinkage int swsusp_save(void)
871{ 871{
872 int error = 0;
873
874 if ((error = swsusp_swap_check())) {
875 printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try "
876 "swapon -a!\n");
877 return error;
878 }
879 return suspend_prepare_image(); 872 return suspend_prepare_image();
880} 873}
881 874
@@ -892,14 +885,20 @@ int swsusp_suspend(void)
892 * at resume time, and evil weirdness ensues. 885 * at resume time, and evil weirdness ensues.
893 */ 886 */
894 if ((error = device_power_down(PMSG_FREEZE))) { 887 if ((error = device_power_down(PMSG_FREEZE))) {
895 printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
896 local_irq_enable(); 888 local_irq_enable();
897 swsusp_free();
898 return error; 889 return error;
899 } 890 }
891
892 if ((error = swsusp_swap_check())) {
893 printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try "
894 "swapon -a!\n");
895 local_irq_enable();
896 return error;
897 }
898
900 save_processor_state(); 899 save_processor_state();
901 if ((error = swsusp_arch_suspend())) 900 if ((error = swsusp_arch_suspend()))
902 swsusp_free(); 901 printk("Error %d suspending\n", error);
903 /* Restore control flow magically appears here */ 902 /* Restore control flow magically appears here */
904 restore_processor_state(); 903 restore_processor_state();
905 BUG_ON (nr_copy_pages_check != nr_copy_pages); 904 BUG_ON (nr_copy_pages_check != nr_copy_pages);
@@ -1166,9 +1165,9 @@ static int bio_write_page(pgoff_t page_off, void * page)
1166static const char * sanity_check(void) 1165static const char * sanity_check(void)
1167{ 1166{
1168 dump_info(); 1167 dump_info();
1169 if(swsusp_info.version_code != LINUX_VERSION_CODE) 1168 if (swsusp_info.version_code != LINUX_VERSION_CODE)
1170 return "kernel version"; 1169 return "kernel version";
1171 if(swsusp_info.num_physpages != num_physpages) 1170 if (swsusp_info.num_physpages != num_physpages)
1172 return "memory size"; 1171 return "memory size";
1173 if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) 1172 if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname))
1174 return "system type"; 1173 return "system type";
@@ -1356,16 +1355,6 @@ int swsusp_check(void)
1356{ 1355{
1357 int error; 1356 int error;
1358 1357
1359 if (!swsusp_resume_device) {
1360 if (!strlen(resume_file))
1361 return -ENOENT;
1362 swsusp_resume_device = name_to_dev_t(resume_file);
1363 pr_debug("swsusp: Resume From Partition %s\n", resume_file);
1364 } else {
1365 pr_debug("swsusp: Resume From Partition %d:%d\n",
1366 MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
1367 }
1368
1369 resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); 1358 resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ);
1370 if (!IS_ERR(resume_bdev)) { 1359 if (!IS_ERR(resume_bdev)) {
1371 set_blocksize(resume_bdev, PAGE_SIZE); 1360 set_blocksize(resume_bdev, PAGE_SIZE);