All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output
@ 2016-02-23 16:49 Geert Uytterhoeven
  2016-02-23 16:49 ` [PATCH 2/2] [RFC] PM / Domains: Join state name and index " Geert Uytterhoeven
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2016-02-23 16:49 UTC (permalink / raw)
  To: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson, Axel Haslam,
	Lina Iyer
  Cc: linux-pm, Geert Uytterhoeven

The slave domains are no longer aligned with the table header in the
/sys/kernel/debug/pm_genpd/pm_genpd_summary output. Worse, the alignment
differs depending on the actual name of the state.

Format the state name and index into a buffer, and print that like
before to restore alignment.

Use "%u" for unsigned int while we're at it.

Fixes: fc5cbf0c94b6f7fd ("PM / Domains: Support for multiple states")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/base/power/domain.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index e8ca290dbf9d5ea6..01015d85ab6493fc 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1882,6 +1882,7 @@ static int pm_genpd_summary_one(struct seq_file *s,
 	struct pm_domain_data *pm_data;
 	const char *kobj_path;
 	struct gpd_link *link;
+	char state[16];
 	int ret;
 
 	ret = mutex_lock_interruptible(&genpd->lock);
@@ -1890,12 +1891,13 @@ static int pm_genpd_summary_one(struct seq_file *s,
 
 	if (WARN_ON(genpd->status >= ARRAY_SIZE(status_lookup)))
 		goto exit;
-	seq_printf(s, "%-30s  %s", genpd->name, status_lookup[genpd->status]);
-
 	if (genpd->status == GPD_STATE_POWER_OFF)
-		seq_printf(s, " %-13d ", genpd->state_idx);
+		snprintf(state, sizeof(state), "%s %u",
+			 status_lookup[genpd->status], genpd->state_idx);
 	else
-		seq_printf(s, " %-15s ", "");
+		snprintf(state, sizeof(state), "%s",
+			 status_lookup[genpd->status]);
+	seq_printf(s, "%-30s  %-15s ", genpd->name, state);
 
 	/*
 	 * Modifications on the list require holding locks on both
-- 
1.9.1


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

end of thread, other threads:[~2016-03-10 23:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-23 16:49 [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output Geert Uytterhoeven
2016-02-23 16:49 ` [PATCH 2/2] [RFC] PM / Domains: Join state name and index " Geert Uytterhoeven
2016-02-29 12:04   ` Ulf Hansson
2016-03-01 18:55   ` Kevin Hilman
2016-02-24  9:31 ` [PATCH 1/2] PM / Domains: Restore alignment of slaves " Axel Haslam
2016-02-29 12:03 ` Ulf Hansson
2016-03-01 18:54 ` Kevin Hilman
2016-03-10 23:22 ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.