@@ -766,6 +766,8 @@ int hibernate(void)
}
pr_info("hibernation entry\n");
+ pm_suspend_target_state = PM_SUSPEND_MAX;
+
pm_prepare_console();
error = pm_notifier_call_chain_robust(PM_HIBERNATION_PREPARE,
PM_POST_HIBERNATION);
if (error)
@@ -846,6 +848,7 @@ int hibernate(void)
hibernate_release();
Unlock:
unlock_system_sleep(sleep_flags);
+ pm_suspend_target_state = PM_SUSPEND_ON;
pr_info("hibernation exit\n");
return error;
@@ -493,7 +493,6 @@ int suspend_devices_and_enter(suspend_state_t state)
if (!sleep_state_supported(state))
return -ENOSYS;
- pm_suspend_target_state = state;
if (state == PM_SUSPEND_TO_IDLE)
pm_set_suspend_no_platform();
@@ -584,6 +583,8 @@ static int enter_state(suspend_state_t state)
}
pm_pr_dbg("Preparing system for sleep (%s)\n",
mem_sleep_labels[state]);
+ pm_suspend_target_state = state;
+
pm_suspend_clear_flags();
error = suspend_prepare(state);