aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/disk.c5
-rw-r--r--kernel/power/user.c31
2 files changed, 24 insertions, 12 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index b138b431e271..659736508239 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -499,6 +499,10 @@ static int software_resume(void)
499 goto Unlock; 499 goto Unlock;
500 } 500 }
501 501
502 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
503 if (error)
504 goto Finish;
505
502 error = create_basic_memory_bitmaps(); 506 error = create_basic_memory_bitmaps();
503 if (error) 507 if (error)
504 goto Finish; 508 goto Finish;
@@ -522,6 +526,7 @@ static int software_resume(void)
522 Done: 526 Done:
523 free_basic_memory_bitmaps(); 527 free_basic_memory_bitmaps();
524 Finish: 528 Finish:
529 pm_notifier_call_chain(PM_POST_RESTORE);
525 atomic_inc(&snapshot_device_available); 530 atomic_inc(&snapshot_device_available);
526 /* For success case, the suspend path will release the lock */ 531 /* For success case, the suspend path will release the lock */
527 Unlock: 532 Unlock:
diff --git a/kernel/power/user.c b/kernel/power/user.c
index b902a7e3bd12..f5512cb3aa86 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -67,6 +67,7 @@ atomic_t snapshot_device_available = ATOMIC_INIT(1);
67static int snapshot_open(struct inode *inode, struct file *filp) 67static int snapshot_open(struct inode *inode, struct file *filp)
68{ 68{
69 struct snapshot_data *data; 69 struct snapshot_data *data;
70 int error;
70 71
71 if (!atomic_add_unless(&snapshot_device_available, -1, 0)) 72 if (!atomic_add_unless(&snapshot_device_available, -1, 0))
72 return -EBUSY; 73 return -EBUSY;
@@ -87,9 +88,19 @@ static int snapshot_open(struct inode *inode, struct file *filp)
87 data->swap = swsusp_resume_device ? 88 data->swap = swsusp_resume_device ?
88 swap_type_of(swsusp_resume_device, 0, NULL) : -1; 89 swap_type_of(swsusp_resume_device, 0, NULL) : -1;
89 data->mode = O_RDONLY; 90 data->mode = O_RDONLY;
91 error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
92 if (error)
93 pm_notifier_call_chain(PM_POST_RESTORE);
90 } else { 94 } else {
91 data->swap = -1; 95 data->swap = -1;
92 data->mode = O_WRONLY; 96 data->mode = O_WRONLY;
97 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
98 if (error)
99 pm_notifier_call_chain(PM_POST_HIBERNATION);
100 }
101 if (error) {
102 atomic_inc(&snapshot_device_available);
103 return error;
93 } 104 }
94 data->frozen = 0; 105 data->frozen = 0;
95 data->ready = 0; 106 data->ready = 0;
@@ -111,6 +122,8 @@ static int snapshot_release(struct inode *inode, struct file *filp)
111 thaw_processes(); 122 thaw_processes();
112 mutex_unlock(&pm_mutex); 123 mutex_unlock(&pm_mutex);
113 } 124 }
125 pm_notifier_call_chain(data->mode == O_WRONLY ?
126 PM_POST_HIBERNATION : PM_POST_RESTORE);
114 atomic_inc(&snapshot_device_available); 127 atomic_inc(&snapshot_device_available);
115 return 0; 128 return 0;
116} 129}
@@ -174,18 +187,13 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
174 if (data->frozen) 187 if (data->frozen)
175 break; 188 break;
176 mutex_lock(&pm_mutex); 189 mutex_lock(&pm_mutex);
177 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); 190 printk("Syncing filesystems ... ");
178 if (!error) { 191 sys_sync();
179 printk("Syncing filesystems ... "); 192 printk("done.\n");
180 sys_sync(); 193
181 printk("done.\n"); 194 error = freeze_processes();
182
183 error = freeze_processes();
184 if (error)
185 thaw_processes();
186 }
187 if (error) 195 if (error)
188 pm_notifier_call_chain(PM_POST_HIBERNATION); 196 thaw_processes();
189 mutex_unlock(&pm_mutex); 197 mutex_unlock(&pm_mutex);
190 if (!error) 198 if (!error)
191 data->frozen = 1; 199 data->frozen = 1;
@@ -196,7 +204,6 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
196 break; 204 break;
197 mutex_lock(&pm_mutex); 205 mutex_lock(&pm_mutex);
198 thaw_processes(); 206 thaw_processes();
199 pm_notifier_call_chain(PM_POST_HIBERNATION);
200 mutex_unlock(&pm_mutex); 207 mutex_unlock(&pm_mutex);
201 data->frozen = 0; 208 data->frozen = 0;
202 break; 209 break;