]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PM / sleep: Mark suspend/hibernation start and finish
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 20 Jul 2017 01:38:07 +0000 (03:38 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 22 Jul 2017 00:33:03 +0000 (02:33 +0200)
Regardless of whether or not debug messages from the core system
suspend/hibernation code are enabled, it is useful to know when
system-wide transitions start and finish (or fail), so print "info"
messages at these points.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Mark Salyzyn <salyzyn@android.com>
kernel/power/hibernate.c
kernel/power/suspend.c

index e19ee179d2112dc0b4ec6711c1126964655ca57f..a5c36e9c56a670c59cabe20376f2ce1aedcd5e8a 100644 (file)
@@ -692,6 +692,7 @@ int hibernate(void)
                goto Unlock;
        }
 
+       pr_info("hibernation entry\n");
        pm_prepare_console();
        error = __pm_notifier_call_chain(PM_HIBERNATION_PREPARE, -1, &nr_calls);
        if (error) {
@@ -762,6 +763,8 @@ int hibernate(void)
        atomic_inc(&snapshot_device_available);
  Unlock:
        unlock_system_sleep();
+       pr_info("hibernation exit\n");
+
        return error;
 }
 
@@ -868,6 +871,7 @@ static int software_resume(void)
                goto Unlock;
        }
 
+       pr_info("resume from hibernation\n");
        pm_prepare_console();
        error = __pm_notifier_call_chain(PM_RESTORE_PREPARE, -1, &nr_calls);
        if (error) {
@@ -884,6 +888,7 @@ static int software_resume(void)
  Finish:
        __pm_notifier_call_chain(PM_POST_RESTORE, nr_calls, NULL);
        pm_restore_console();
+       pr_info("resume from hibernation failed (%d)\n", error);
        atomic_inc(&snapshot_device_available);
        /* For success case, the suspend path will release the lock */
  Unlock:
index 4f10773322fa4d4d58cb3d90eaf193bfc2415fc8..18cdb1596d274b0c4371fa961f17fb6775966cc2 100644 (file)
@@ -584,6 +584,7 @@ int pm_suspend(suspend_state_t state)
        if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
                return -EINVAL;
 
+       pr_info("PM: suspend entry (%s)\n", pm_states[state]);
        error = enter_state(state);
        if (error) {
                suspend_stats.fail++;
@@ -591,6 +592,7 @@ int pm_suspend(suspend_state_t state)
        } else {
                suspend_stats.success++;
        }
+       pr_info("PM: suspend exit\n");
        return error;
 }
 EXPORT_SYMBOL(pm_suspend);