aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/user.c')
-rw-r--r--kernel/power/user.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 6c85359364f2..bf0014d6a5f0 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -23,7 +23,7 @@
23#include <linux/console.h> 23#include <linux/console.h>
24#include <linux/cpu.h> 24#include <linux/cpu.h>
25#include <linux/freezer.h> 25#include <linux/freezer.h>
26#include <linux/smp_lock.h> 26#include <scsi/scsi_scan.h>
27 27
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29 29
@@ -92,6 +92,7 @@ static int snapshot_open(struct inode *inode, struct file *filp)
92 filp->private_data = data; 92 filp->private_data = data;
93 memset(&data->handle, 0, sizeof(struct snapshot_handle)); 93 memset(&data->handle, 0, sizeof(struct snapshot_handle));
94 if ((filp->f_flags & O_ACCMODE) == O_RDONLY) { 94 if ((filp->f_flags & O_ACCMODE) == O_RDONLY) {
95 /* Hibernating. The image device should be accessible. */
95 data->swap = swsusp_resume_device ? 96 data->swap = swsusp_resume_device ?
96 swap_type_of(swsusp_resume_device, 0, NULL) : -1; 97 swap_type_of(swsusp_resume_device, 0, NULL) : -1;
97 data->mode = O_RDONLY; 98 data->mode = O_RDONLY;
@@ -99,6 +100,13 @@ static int snapshot_open(struct inode *inode, struct file *filp)
99 if (error) 100 if (error)
100 pm_notifier_call_chain(PM_POST_HIBERNATION); 101 pm_notifier_call_chain(PM_POST_HIBERNATION);
101 } else { 102 } else {
103 /*
104 * Resuming. We may need to wait for the image device to
105 * appear.
106 */
107 wait_for_device_probe();
108 scsi_complete_async_scans();
109
102 data->swap = -1; 110 data->swap = -1;
103 data->mode = O_WRONLY; 111 data->mode = O_WRONLY;
104 error = pm_notifier_call_chain(PM_RESTORE_PREPARE); 112 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);