Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH 0/2] PM / suspend: Messaging updates
@ 2017-07-21 12:48 Rafael J. Wysocki
  2017-07-21 12:49 ` [PATCH 1/2] PM / suspend: Use mem_sleep_labels[] strings in messages Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-07-21 12:48 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML

Hi,

The first patch addresses a potential confusion regarding messages printed by
the suspend core code to the kernel log and the second one adds a pr_fmt() to
kernel/power/suspend.c.

The patches are on top of the series I posted yesterday:

http://marc.info/?l=linux-pm&m=150059650805506&w=2

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] PM / suspend: Use mem_sleep_labels[] strings in messages
  2017-07-21 12:48 [PATCH 0/2] PM / suspend: Messaging updates Rafael J. Wysocki
@ 2017-07-21 12:49 ` Rafael J. Wysocki
  2017-07-21 12:50 ` [PATCH 2/2] PM / suspend: Define pr_fmt() in suspend.c Rafael J. Wysocki
  2017-07-21 15:13 ` [PATCH 0/2] PM / suspend: Messaging updates Andy Shevchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-07-21 12:49 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Some messages in suspend.c currently print state names from
pm_states[], but that may be confusing if the mem_sleep sysfs
attribute is changed to anything different from "mem", because
in those cases the messages will say either "freeze" or "standby"
after writing "mem" to /sys/power/state.

To avoid the confusion, use mem_sleep_labels[] strings in those
messages instead.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/power/suspend.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: linux-pm/kernel/power/suspend.c
===================================================================
--- linux-pm.orig/kernel/power/suspend.c
+++ linux-pm/kernel/power/suspend.c
@@ -555,7 +555,7 @@ static int enter_state(suspend_state_t s
 	trace_suspend_resume(TPS("sync_filesystems"), 0, false);
 #endif
 
-	pm_pr_dbg("Preparing system for sleep (%s)\n", pm_states[state]);
+	pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
 	pm_suspend_clear_flags();
 	error = suspend_prepare(state);
 	if (error)
@@ -565,7 +565,7 @@ static int enter_state(suspend_state_t s
 		goto Finish;
 
 	trace_suspend_resume(TPS("suspend_enter"), state, false);
-	pm_pr_dbg("Suspending system (%s)\n", pm_states[state]);
+	pm_pr_dbg("Suspending system (%s)\n", mem_sleep_labels[state]);
 	pm_restrict_gfp_mask();
 	error = suspend_devices_and_enter(state);
 	pm_restore_gfp_mask();
@@ -592,7 +592,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]);
+	pr_info("PM: suspend entry (%s)\n", mem_sleep_labels[state]);
 	error = enter_state(state);
 	if (error) {
 		suspend_stats.fail++;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] PM / suspend: Define pr_fmt() in suspend.c
  2017-07-21 12:48 [PATCH 0/2] PM / suspend: Messaging updates Rafael J. Wysocki
  2017-07-21 12:49 ` [PATCH 1/2] PM / suspend: Use mem_sleep_labels[] strings in messages Rafael J. Wysocki
@ 2017-07-21 12:50 ` Rafael J. Wysocki
  2017-07-21 15:13 ` [PATCH 0/2] PM / suspend: Messaging updates Andy Shevchenko
  2 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-07-21 12:50 UTC (permalink / raw)
  To: Linux PM; +Cc: LKML

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Define a common prefix ("PM:") for messages printed by the
code in kernel/power/suspend.c.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 kernel/power/suspend.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Index: linux-pm/kernel/power/suspend.c
===================================================================
--- linux-pm.orig/kernel/power/suspend.c
+++ linux-pm/kernel/power/suspend.c
@@ -8,6 +8,8 @@
  * This file is released under the GPLv2.
  */
 
+#define pr_fmt(fmt) "PM: " fmt
+
 #include <linux/string.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
@@ -389,7 +391,7 @@ static int suspend_enter(suspend_state_t
 
 	error = dpm_suspend_late(PMSG_SUSPEND);
 	if (error) {
-		pr_err("PM: late suspend of devices failed\n");
+		pr_err("late suspend of devices failed\n");
 		goto Platform_finish;
 	}
 	error = platform_suspend_prepare_late(state);
@@ -403,7 +405,7 @@ static int suspend_enter(suspend_state_t
 
 	error = dpm_suspend_noirq(PMSG_SUSPEND);
 	if (error) {
-		pr_err("PM: noirq suspend of devices failed\n");
+		pr_err("noirq suspend of devices failed\n");
 		goto Platform_early_resume;
 	}
 	error = platform_suspend_prepare_noirq(state);
@@ -477,7 +479,7 @@ int suspend_devices_and_enter(suspend_st
 	suspend_test_start();
 	error = dpm_suspend_start(PMSG_SUSPEND);
 	if (error) {
-		pr_err("PM: Some devices failed to suspend, or early wake event detected\n");
+		pr_err("Some devices failed to suspend, or early wake event detected\n");
 		goto Recover_platform;
 	}
 	suspend_test_finish("suspend devices");
@@ -534,7 +536,7 @@ static int enter_state(suspend_state_t s
 	if (state == PM_SUSPEND_FREEZE) {
 #ifdef CONFIG_PM_DEBUG
 		if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
-			pr_warn("PM: Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n");
+			pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n");
 			return -EAGAIN;
 		}
 #endif
@@ -549,7 +551,7 @@ static int enter_state(suspend_state_t s
 
 #ifndef CONFIG_SUSPEND_SKIP_SYNC
 	trace_suspend_resume(TPS("sync_filesystems"), 0, true);
-	pr_info("PM: Syncing filesystems ... ");
+	pr_info("Syncing filesystems ... ");
 	sys_sync();
 	pr_cont("done.\n");
 	trace_suspend_resume(TPS("sync_filesystems"), 0, false);
@@ -592,7 +594,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", mem_sleep_labels[state]);
+	pr_info("suspend entry (%s)\n", mem_sleep_labels[state]);
 	error = enter_state(state);
 	if (error) {
 		suspend_stats.fail++;
@@ -600,7 +602,7 @@ int pm_suspend(suspend_state_t state)
 	} else {
 		suspend_stats.success++;
 	}
-	pr_info("PM: suspend exit\n");
+	pr_info("suspend exit\n");
 	return error;
 }
 EXPORT_SYMBOL(pm_suspend);

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] PM / suspend: Messaging updates
  2017-07-21 12:48 [PATCH 0/2] PM / suspend: Messaging updates Rafael J. Wysocki
  2017-07-21 12:49 ` [PATCH 1/2] PM / suspend: Use mem_sleep_labels[] strings in messages Rafael J. Wysocki
  2017-07-21 12:50 ` [PATCH 2/2] PM / suspend: Define pr_fmt() in suspend.c Rafael J. Wysocki
@ 2017-07-21 15:13 ` Andy Shevchenko
  2017-07-21 20:42   ` Rafael J. Wysocki
  2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2017-07-21 15:13 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Linux PM, LKML

On Fri, Jul 21, 2017 at 3:48 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> Hi,
>
> The first patch addresses a potential confusion regarding messages printed by
> the suspend core code to the kernel log and the second one adds a pr_fmt() to
> kernel/power/suspend.c.
>
> The patches are on top of the series I posted yesterday:
>
> http://marc.info/?l=linux-pm&m=150059650805506&w=2

Standardization is what I like.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

>
> Thanks,
> Rafael



-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] PM / suspend: Messaging updates
  2017-07-21 15:13 ` [PATCH 0/2] PM / suspend: Messaging updates Andy Shevchenko
@ 2017-07-21 20:42   ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-07-21 20:42 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Linux PM, LKML

On Friday, July 21, 2017 06:13:45 PM Andy Shevchenko wrote:
> On Fri, Jul 21, 2017 at 3:48 PM, Rafael J. Wysocki <rjw@rjwysocki.net> wrote:
> > Hi,
> >
> > The first patch addresses a potential confusion regarding messages printed by
> > the suspend core code to the kernel log and the second one adds a pr_fmt() to
> > kernel/power/suspend.c.
> >
> > The patches are on top of the series I posted yesterday:
> >
> > http://marc.info/?l=linux-pm&m=150059650805506&w=2
> 
> Standardization is what I like.
> 
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-07-21 20:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21 12:48 [PATCH 0/2] PM / suspend: Messaging updates Rafael J. Wysocki
2017-07-21 12:49 ` [PATCH 1/2] PM / suspend: Use mem_sleep_labels[] strings in messages Rafael J. Wysocki
2017-07-21 12:50 ` [PATCH 2/2] PM / suspend: Define pr_fmt() in suspend.c Rafael J. Wysocki
2017-07-21 15:13 ` [PATCH 0/2] PM / suspend: Messaging updates Andy Shevchenko
2017-07-21 20:42   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox