linux-pm.vger.kernel.org archive mirror
 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

* [PATCH 2/2] [RFC] PM / Domains: Join state name and index in debugfs output
  2016-02-23 16:49 [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output Geert Uytterhoeven
@ 2016-02-23 16:49 ` 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
                   ` (3 subsequent siblings)
  4 siblings, 2 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

For low-power states, the state index is part of the state, hence join
them with a hyphen in the /sys/kernel/debug/pm_genpd/pm_genpd_summary
output. E.g. "off 0" becomes "off-0".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
Alternative separators could be ":" or "/".
---
 drivers/base/power/domain.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 01015d85ab6493fc..9e59543d314c4b0b 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1892,7 +1892,7 @@ static int pm_genpd_summary_one(struct seq_file *s,
 	if (WARN_ON(genpd->status >= ARRAY_SIZE(status_lookup)))
 		goto exit;
 	if (genpd->status == GPD_STATE_POWER_OFF)
-		snprintf(state, sizeof(state), "%s %u",
+		snprintf(state, sizeof(state), "%s-%u",
 			 status_lookup[genpd->status], genpd->state_idx);
 	else
 		snprintf(state, sizeof(state), "%s",
-- 
1.9.1


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

* Re: [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output
  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-24  9:31 ` Axel Haslam
  2016-02-29 12:03 ` Ulf Hansson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Axel Haslam @ 2016-02-24  9:31 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Kevin Hilman, Ulf Hansson, Axel Haslam,
	Lina Iyer, Linux PM list

Hi Geert,

On Tue, Feb 23, 2016 at 5:49 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
>
> 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")

Thanks for fixing this. My power domains had all equal size names and
i had not noticed the unaligned columns on the summary.

Regards
Axel

>
> 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	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output
  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-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
  4 siblings, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2016-02-29 12:03 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Kevin Hilman, Axel Haslam, Lina Iyer,
	linux-pm@vger.kernel.org

On 23 February 2016 at 17:49, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> 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>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  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	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] [RFC] PM / Domains: Join state name and index in debugfs output
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2016-02-29 12:04 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Kevin Hilman, Axel Haslam, Lina Iyer,
	linux-pm@vger.kernel.org

On 23 February 2016 at 17:49, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> For low-power states, the state index is part of the state, hence join
> them with a hyphen in the /sys/kernel/debug/pm_genpd/pm_genpd_summary
> output. E.g. "off 0" becomes "off-0".
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
> Alternative separators could be ":" or "/".
> ---
>  drivers/base/power/domain.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 01015d85ab6493fc..9e59543d314c4b0b 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1892,7 +1892,7 @@ static int pm_genpd_summary_one(struct seq_file *s,
>         if (WARN_ON(genpd->status >= ARRAY_SIZE(status_lookup)))
>                 goto exit;
>         if (genpd->status == GPD_STATE_POWER_OFF)
> -               snprintf(state, sizeof(state), "%s %u",
> +               snprintf(state, sizeof(state), "%s-%u",
>                          status_lookup[genpd->status], genpd->state_idx);
>         else
>                 snprintf(state, sizeof(state), "%s",
> --
> 1.9.1
>

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

* Re: [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output
  2016-02-23 16:49 [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2016-02-29 12:03 ` Ulf Hansson
@ 2016-03-01 18:54 ` Kevin Hilman
  2016-03-10 23:22 ` Rafael J. Wysocki
  4 siblings, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2016-03-01 18:54 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Ulf Hansson, Axel Haslam, Lina Iyer, linux-pm

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> 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>

Tested-by: Kevin Hilman <khilman@baylibre.com>

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

* Re: [PATCH 2/2] [RFC] PM / Domains: Join state name and index in debugfs output
  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
  1 sibling, 0 replies; 8+ messages in thread
From: Kevin Hilman @ 2016-03-01 18:55 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rafael J. Wysocki, Ulf Hansson, Axel Haslam, Lina Iyer, linux-pm

Geert Uytterhoeven <geert+renesas@glider.be> writes:

> For low-power states, the state index is part of the state, hence join
> them with a hyphen in the /sys/kernel/debug/pm_genpd/pm_genpd_summary
> output. E.g. "off 0" becomes "off-0".
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Tested-by: Kevin Hilman <khilman@baylibre.com>

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

* Re: [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output
  2016-02-23 16:49 [PATCH 1/2] PM / Domains: Restore alignment of slaves in debugfs output Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2016-03-01 18:54 ` Kevin Hilman
@ 2016-03-10 23:22 ` Rafael J. Wysocki
  4 siblings, 0 replies; 8+ messages in thread
From: Rafael J. Wysocki @ 2016-03-10 23:22 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Kevin Hilman, Ulf Hansson, Axel Haslam, Lina Iyer, linux-pm

On Tuesday, February 23, 2016 05:49:17 PM Geert Uytterhoeven wrote:
> 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>

Both this one and the [2/2] applied, thanks!

Rafael


^ permalink raw reply	[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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).