提交 5a0a2f30 编写于 作者: R Rafael J. Wysocki 提交者: Len Brown

Hibernation: Invoke suspend notifications after console switch

Following the recent change in the suspend code path, switch consoles before
calling PM notifiers during hibernation.
Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 af258f51
...@@ -458,20 +458,13 @@ static void power_down(void) ...@@ -458,20 +458,13 @@ static void power_down(void)
while(1); while(1);
} }
static void unprepare_processes(void)
{
thaw_processes();
pm_restore_console();
}
static int prepare_processes(void) static int prepare_processes(void)
{ {
int error = 0; int error = 0;
pm_prepare_console();
if (freeze_processes()) { if (freeze_processes()) {
error = -EBUSY; error = -EBUSY;
unprepare_processes(); thaw_processes();
} }
return error; return error;
} }
...@@ -491,6 +484,7 @@ int hibernate(void) ...@@ -491,6 +484,7 @@ int hibernate(void)
goto Unlock; goto Unlock;
} }
pm_prepare_console();
error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
if (error) if (error)
goto Exit; goto Exit;
...@@ -530,11 +524,12 @@ int hibernate(void) ...@@ -530,11 +524,12 @@ int hibernate(void)
swsusp_free(); swsusp_free();
} }
Thaw: Thaw:
unprepare_processes(); thaw_processes();
Finish: Finish:
free_basic_memory_bitmaps(); free_basic_memory_bitmaps();
Exit: Exit:
pm_notifier_call_chain(PM_POST_HIBERNATION); pm_notifier_call_chain(PM_POST_HIBERNATION);
pm_restore_console();
atomic_inc(&snapshot_device_available); atomic_inc(&snapshot_device_available);
Unlock: Unlock:
mutex_unlock(&pm_mutex); mutex_unlock(&pm_mutex);
...@@ -603,6 +598,7 @@ static int software_resume(void) ...@@ -603,6 +598,7 @@ static int software_resume(void)
goto Unlock; goto Unlock;
} }
pm_prepare_console();
error = pm_notifier_call_chain(PM_RESTORE_PREPARE); error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
if (error) if (error)
goto Finish; goto Finish;
...@@ -626,11 +622,12 @@ static int software_resume(void) ...@@ -626,11 +622,12 @@ static int software_resume(void)
printk(KERN_ERR "PM: Restore failed, recovering.\n"); printk(KERN_ERR "PM: Restore failed, recovering.\n");
swsusp_free(); swsusp_free();
unprepare_processes(); thaw_processes();
Done: Done:
free_basic_memory_bitmaps(); free_basic_memory_bitmaps();
Finish: Finish:
pm_notifier_call_chain(PM_POST_RESTORE); pm_notifier_call_chain(PM_POST_RESTORE);
pm_restore_console();
atomic_inc(&snapshot_device_available); atomic_inc(&snapshot_device_available);
/* For success case, the suspend path will release the lock */ /* For success case, the suspend path will release the lock */
Unlock: Unlock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册