[PATCH] pm: Fix resume from initrd
authorPavel Machek <pavel@ucw.cz>
Fri, 8 Jul 2005 00:56:43 +0000 (17:56 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 8 Jul 2005 01:23:43 +0000 (18:23 -0700)
Move device name resolution code around so that it is not called from
resume-from-initrd.  name_to_dev_t may be unavailable at that point.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/power/disk.c
kernel/power/swsusp.c

index fb8de63c29192061a6938417bac924a55e800851..c51a4d96d4ebc68c469d40bb1cdd3c31605c1aad 100644 (file)
@@ -234,6 +234,16 @@ static int software_resume(void)
 {
        int error;
 
+       if (!swsusp_resume_device) {
+               if (!strlen(resume_file))
+                       return -ENOENT;
+               swsusp_resume_device = name_to_dev_t(resume_file);
+               pr_debug("swsusp: Resume From Partition %s\n", resume_file);
+       } else {
+               pr_debug("swsusp: Resume From Partition %d:%d\n",
+                        MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
+       }
+
        if (noresume) {
                /**
                 * FIXME: If noresume is specified, we need to find the partition
index c285fc5a232094c9f7b5e27950525ae942bc99b1..d82c1f7d0a6057d5672d0ef569fa689be72f3a9c 100644 (file)
@@ -1356,16 +1356,6 @@ int swsusp_check(void)
 {
        int error;
 
-       if (!swsusp_resume_device) {
-               if (!strlen(resume_file))
-                       return -ENOENT;
-               swsusp_resume_device = name_to_dev_t(resume_file);
-               pr_debug("swsusp: Resume From Partition %s\n", resume_file);
-       } else {
-               pr_debug("swsusp: Resume From Partition %d:%d\n",
-                        MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device));
-       }
-
        resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ);
        if (!IS_ERR(resume_bdev)) {
                set_blocksize(resume_bdev, PAGE_SIZE);