aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r--kernel/power/disk.c45
1 files changed, 28 insertions, 17 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 5f21ab2bbcdf..e71ca9cd81b2 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -22,6 +22,7 @@
22#include <linux/console.h> 22#include <linux/console.h>
23#include <linux/cpu.h> 23#include <linux/cpu.h>
24#include <linux/freezer.h> 24#include <linux/freezer.h>
25#include <scsi/scsi_scan.h>
25#include <asm/suspend.h> 26#include <asm/suspend.h>
26 27
27#include "power.h" 28#include "power.h"
@@ -655,32 +656,42 @@ static int software_resume(void)
655 * here to avoid lockdep complaining. 656 * here to avoid lockdep complaining.
656 */ 657 */
657 mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING); 658 mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING);
659
660 if (swsusp_resume_device)
661 goto Check_image;
662
663 if (!strlen(resume_file)) {
664 error = -ENOENT;
665 goto Unlock;
666 }
667
668 pr_debug("PM: Checking image partition %s\n", resume_file);
669
670 /* Check if the device is there */
671 swsusp_resume_device = name_to_dev_t(resume_file);
658 if (!swsusp_resume_device) { 672 if (!swsusp_resume_device) {
659 if (!strlen(resume_file)) {
660 mutex_unlock(&pm_mutex);
661 return -ENOENT;
662 }
663 /* 673 /*
664 * Some device discovery might still be in progress; we need 674 * Some device discovery might still be in progress; we need
665 * to wait for this to finish. 675 * to wait for this to finish.
666 */ 676 */
667 wait_for_device_probe(); 677 wait_for_device_probe();
678 /*
679 * We can't depend on SCSI devices being available after loading
680 * one of their modules until scsi_complete_async_scans() is
681 * called and the resume device usually is a SCSI one.
682 */
683 scsi_complete_async_scans();
684
668 swsusp_resume_device = name_to_dev_t(resume_file); 685 swsusp_resume_device = name_to_dev_t(resume_file);
669 pr_debug("PM: Resume from partition %s\n", resume_file); 686 if (!swsusp_resume_device) {
670 } else { 687 error = -ENODEV;
671 pr_debug("PM: Resume from partition %d:%d\n", 688 goto Unlock;
672 MAJOR(swsusp_resume_device), 689 }
673 MINOR(swsusp_resume_device));
674 } 690 }
675 691
676 if (noresume) { 692 Check_image:
677 /** 693 pr_debug("PM: Resume from partition %d:%d\n",
678 * FIXME: If noresume is specified, we need to find the 694 MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
679 * partition and reset it back to normal swap space.
680 */
681 mutex_unlock(&pm_mutex);
682 return 0;
683 }
684 695
685 pr_debug("PM: Checking hibernation image.\n"); 696 pr_debug("PM: Checking hibernation image.\n");
686 error = swsusp_check(); 697 error = swsusp_check();