diff options
Diffstat (limited to 'kernel/power/swsusp.c')
| -rw-r--r-- | kernel/power/swsusp.c | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index c285fc5a2320..f2bc71b9fe8b 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
| @@ -63,6 +63,7 @@ | |||
| 63 | #include <linux/console.h> | 63 | #include <linux/console.h> |
| 64 | #include <linux/highmem.h> | 64 | #include <linux/highmem.h> |
| 65 | #include <linux/bio.h> | 65 | #include <linux/bio.h> |
| 66 | #include <linux/mount.h> | ||
| 66 | 67 | ||
| 67 | #include <asm/uaccess.h> | 68 | #include <asm/uaccess.h> |
| 68 | #include <asm/mmu_context.h> | 69 | #include <asm/mmu_context.h> |
| @@ -869,13 +870,6 @@ extern asmlinkage int swsusp_arch_resume(void); | |||
| 869 | 870 | ||
| 870 | asmlinkage int swsusp_save(void) | 871 | asmlinkage int swsusp_save(void) |
| 871 | { | 872 | { |
| 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(); | 873 | return suspend_prepare_image(); |
| 880 | } | 874 | } |
| 881 | 875 | ||
| @@ -892,14 +886,20 @@ int swsusp_suspend(void) | |||
| 892 | * at resume time, and evil weirdness ensues. | 886 | * at resume time, and evil weirdness ensues. |
| 893 | */ | 887 | */ |
| 894 | if ((error = device_power_down(PMSG_FREEZE))) { | 888 | if ((error = device_power_down(PMSG_FREEZE))) { |
| 895 | printk(KERN_ERR "Some devices failed to power down, aborting suspend\n"); | ||
| 896 | local_irq_enable(); | 889 | local_irq_enable(); |
| 897 | swsusp_free(); | ||
| 898 | return error; | 890 | return error; |
| 899 | } | 891 | } |
| 892 | |||
| 893 | if ((error = swsusp_swap_check())) { | ||
| 894 | printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try " | ||
| 895 | "swapon -a!\n"); | ||
| 896 | local_irq_enable(); | ||
| 897 | return error; | ||
| 898 | } | ||
| 899 | |||
| 900 | save_processor_state(); | 900 | save_processor_state(); |
| 901 | if ((error = swsusp_arch_suspend())) | 901 | if ((error = swsusp_arch_suspend())) |
| 902 | swsusp_free(); | 902 | printk("Error %d suspending\n", error); |
| 903 | /* Restore control flow magically appears here */ | 903 | /* Restore control flow magically appears here */ |
| 904 | restore_processor_state(); | 904 | restore_processor_state(); |
| 905 | BUG_ON (nr_copy_pages_check != nr_copy_pages); | 905 | BUG_ON (nr_copy_pages_check != nr_copy_pages); |
| @@ -1166,9 +1166,9 @@ static int bio_write_page(pgoff_t page_off, void * page) | |||
| 1166 | static const char * sanity_check(void) | 1166 | static const char * sanity_check(void) |
| 1167 | { | 1167 | { |
| 1168 | dump_info(); | 1168 | dump_info(); |
| 1169 | if(swsusp_info.version_code != LINUX_VERSION_CODE) | 1169 | if (swsusp_info.version_code != LINUX_VERSION_CODE) |
| 1170 | return "kernel version"; | 1170 | return "kernel version"; |
| 1171 | if(swsusp_info.num_physpages != num_physpages) | 1171 | if (swsusp_info.num_physpages != num_physpages) |
| 1172 | return "memory size"; | 1172 | return "memory size"; |
| 1173 | if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) | 1173 | if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) |
| 1174 | return "system type"; | 1174 | return "system type"; |
| @@ -1261,8 +1261,6 @@ static int data_read(struct pbe *pblist) | |||
| 1261 | return error; | 1261 | return error; |
| 1262 | } | 1262 | } |
| 1263 | 1263 | ||
| 1264 | extern dev_t name_to_dev_t(const char *line); | ||
| 1265 | |||
| 1266 | /** | 1264 | /** |
| 1267 | * read_pagedir - Read page backup list pages from swap | 1265 | * read_pagedir - Read page backup list pages from swap |
| 1268 | */ | 1266 | */ |
| @@ -1356,16 +1354,6 @@ int swsusp_check(void) | |||
| 1356 | { | 1354 | { |
| 1357 | int error; | 1355 | int error; |
| 1358 | 1356 | ||
| 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); | 1357 | resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); |
| 1370 | if (!IS_ERR(resume_bdev)) { | 1358 | if (!IS_ERR(resume_bdev)) { |
| 1371 | set_blocksize(resume_bdev, PAGE_SIZE); | 1359 | set_blocksize(resume_bdev, PAGE_SIZE); |
