PM: Fix pm_notifiers during user mode hibernation
authorAndrey Borzenkov <arvidjaar@mail.ru>
Sat, 14 Feb 2009 01:05:14 +0000 (02:05 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Feb 2009 22:17:17 +0000 (14:17 -0800)
Snapshot device is opened with O_RDONLY during suspend and O_WRONLY durig
resume.  Make sure we also call notifiers with correct parameter telling
them what we are really doing.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <gregkh@suse.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/power/user.c

index 005b93d839ba1268da0c80c3106739ee388d996a..6c85359364f2bcfd31bb06e77ec0eda7585e08dc 100644 (file)
@@ -95,15 +95,15 @@ static int snapshot_open(struct inode *inode, struct file *filp)
                data->swap = swsusp_resume_device ?
                        swap_type_of(swsusp_resume_device, 0, NULL) : -1;
                data->mode = O_RDONLY;
-               error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
+               error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
                if (error)
-                       pm_notifier_call_chain(PM_POST_RESTORE);
+                       pm_notifier_call_chain(PM_POST_HIBERNATION);
        } else {
                data->swap = -1;
                data->mode = O_WRONLY;
-               error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
+               error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
                if (error)
-                       pm_notifier_call_chain(PM_POST_HIBERNATION);
+                       pm_notifier_call_chain(PM_POST_RESTORE);
        }
        if (error)
                atomic_inc(&snapshot_device_available);