aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/hibernate.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/power/hibernate.c')
-rw-r--r--kernel/power/hibernate.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 9c85c7822383..abef759de7c8 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -338,7 +338,7 @@ static int create_image(int platform_mode)
338 * hibernation_snapshot - Quiesce devices and create a hibernation image. 338 * hibernation_snapshot - Quiesce devices and create a hibernation image.
339 * @platform_mode: If set, use platform driver to prepare for the transition. 339 * @platform_mode: If set, use platform driver to prepare for the transition.
340 * 340 *
341 * This routine must be called with pm_mutex held. 341 * This routine must be called with system_transition_mutex held.
342 */ 342 */
343int hibernation_snapshot(int platform_mode) 343int hibernation_snapshot(int platform_mode)
344{ 344{
@@ -500,8 +500,9 @@ static int resume_target_kernel(bool platform_mode)
500 * hibernation_restore - Quiesce devices and restore from a hibernation image. 500 * hibernation_restore - Quiesce devices and restore from a hibernation image.
501 * @platform_mode: If set, use platform driver to prepare for the transition. 501 * @platform_mode: If set, use platform driver to prepare for the transition.
502 * 502 *
503 * This routine must be called with pm_mutex held. If it is successful, control 503 * This routine must be called with system_transition_mutex held. If it is
504 * reappears in the restored target kernel in hibernation_snapshot(). 504 * successful, control reappears in the restored target kernel in
505 * hibernation_snapshot().
505 */ 506 */
506int hibernation_restore(int platform_mode) 507int hibernation_restore(int platform_mode)
507{ 508{
@@ -638,6 +639,7 @@ static void power_down(void)
638 break; 639 break;
639 case HIBERNATION_PLATFORM: 640 case HIBERNATION_PLATFORM:
640 hibernation_platform_enter(); 641 hibernation_platform_enter();
642 /* Fall through */
641 case HIBERNATION_SHUTDOWN: 643 case HIBERNATION_SHUTDOWN:
642 if (pm_power_off) 644 if (pm_power_off)
643 kernel_power_off(); 645 kernel_power_off();
@@ -805,13 +807,13 @@ static int software_resume(void)
805 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs 807 * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
806 * is configured into the kernel. Since the regular hibernate 808 * is configured into the kernel. Since the regular hibernate
807 * trigger path is via sysfs which takes a buffer mutex before 809 * trigger path is via sysfs which takes a buffer mutex before
808 * calling hibernate functions (which take pm_mutex) this can 810 * calling hibernate functions (which take system_transition_mutex)
809 * cause lockdep to complain about a possible ABBA deadlock 811 * this can cause lockdep to complain about a possible ABBA deadlock
810 * which cannot happen since we're in the boot code here and 812 * which cannot happen since we're in the boot code here and
811 * sysfs can't be invoked yet. Therefore, we use a subclass 813 * sysfs can't be invoked yet. Therefore, we use a subclass
812 * here to avoid lockdep complaining. 814 * here to avoid lockdep complaining.
813 */ 815 */
814 mutex_lock_nested(&pm_mutex, SINGLE_DEPTH_NESTING); 816 mutex_lock_nested(&system_transition_mutex, SINGLE_DEPTH_NESTING);
815 817
816 if (swsusp_resume_device) 818 if (swsusp_resume_device)
817 goto Check_image; 819 goto Check_image;
@@ -899,7 +901,7 @@ static int software_resume(void)
899 atomic_inc(&snapshot_device_available); 901 atomic_inc(&snapshot_device_available);
900 /* For success case, the suspend path will release the lock */ 902 /* For success case, the suspend path will release the lock */
901 Unlock: 903 Unlock:
902 mutex_unlock(&pm_mutex); 904 mutex_unlock(&system_transition_mutex);
903 pm_pr_dbg("Hibernation image not present or could not be loaded.\n"); 905 pm_pr_dbg("Hibernation image not present or could not be loaded.\n");
904 return error; 906 return error;
905 Close_Finish: 907 Close_Finish: