path: root/kernel/power
diff options
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-23 00:03:43 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-23 00:03:43 +0200
commitcb08e0353c249a27aed10c6f60a13871ae449d33 (patch)
tree1f0a5ea686df33423b364a98cc692d94b86676ab /kernel/power
parent8915aa2042f85ecf86d4a202ef6d04bf06f05cca (diff)
PM / timekeeping: Print debug messages when requested
The messages printed by tk_debug_account_sleep_time() are basically useful for system sleep debugging, so print them only when the other debug messages from the core suspend/hibernate code are enabled. While at it, make it clear that the messages from tk_debug_account_sleep_time() are about timekeeping suspend duration, because in general timekeeping may be suspeded and resumed for multiple times during one system suspend-resume cycle. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 5ce00902c7e3..b7876eaf83f3 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -388,13 +388,14 @@ static ssize_t pm_debug_messages_store(struct kobject *kobj,
- * pm_pr_dbg - Print a suspend debug message to the kernel log.
+ * __pm_pr_dbg - Print a suspend debug message to the kernel log.
+ * @defer: Whether or not to use printk_deferred() to print the message.
* @fmt: Message format.
* The message will be emitted if enabled through the pm_debug_messages
* sysfs attribute.
-void pm_pr_dbg(const char *fmt, ...)
+void __pm_pr_dbg(bool defer, const char *fmt, ...)
struct va_format vaf;
va_list args;
@@ -407,7 +408,10 @@ void pm_pr_dbg(const char *fmt, ...)
vaf.fmt = fmt;
vaf.va = &args;
- printk(KERN_DEBUG "PM: %pV", &vaf);
+ if (defer)
+ printk_deferred(KERN_DEBUG "PM: %pV", &vaf);
+ else
+ printk(KERN_DEBUG "PM: %pV", &vaf);