public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Quentin Perret <quentin.perret@arm.com>
To: vireshk@kernel.org, nm@ti.com, sboyd@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] PM / OPP: Always expose one supply in debugfs
Date: Mon, 10 Dec 2018 11:54:13 +0000	[thread overview]
Message-ID: <20181210115410.clyrxhp5plptrf5n@queper01-lin> (raw)
In-Reply-To: <20181210113247.11412-1-quentin.perret@arm.com>

On Monday 10 Dec 2018 at 11:32:47 (+0000), Quentin Perret wrote:
> On some platforms, the opp_table->regulator_count field is kept at zero
> even though opp->supplies is always allocated. However, the loop used to
> display the supplies in the debugfs doesn't deal correctly with this,
> which results in the supplies not being displayed in debugfs on those
> platforms.
> 
> Fix this by making sure to always display at least once supply in
> debugfs.
> 
> Signed-off-by: Quentin Perret <quentin.perret@arm.com>
> 
> ---
> 
> This has been observed on Juno r2 which uses SCPI and Hikey960 which
> uses DT. I am not particularly familiar with that part of the code, so
> I'm not sure if this is even remotely correct (hence the RFC tag).
> 
> I first thought setting opp_table->regulator_count to 1 would be the
> right fix but that causes other issues. This fix seems to work OK on
> Juno and Hikey960, at least.
> 
> Feedback is welcome :-)

Hmm, so I just figured what I'm doing here is basically reverting:

    1fae788ed640 ("PM / OPP: Don't create debugfs "supply-0" directory unnecessarily")

Should I send a proper revert instead of this patch ? It _is_ handy to
read voltage numbers when available.

Thanks,
Quentin

> 
> Thanks,
> Quentin
> ---
>  drivers/opp/debugfs.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c
> index e6828e5f81b0..2c14564575cb 100644
> --- a/drivers/opp/debugfs.c
> +++ b/drivers/opp/debugfs.c
> @@ -40,9 +40,9 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
>  				      struct dentry *pdentry)
>  {
>  	struct dentry *d;
> -	int i;
> +	int i = 0;
>  
> -	for (i = 0; i < opp_table->regulator_count; i++) {
> +	do {
>  		char name[15];
>  
>  		snprintf(name, sizeof(name), "supply-%d", i);
> @@ -68,7 +68,9 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
>  		if (!debugfs_create_ulong("u_amp", S_IRUGO, d,
>  					  &opp->supplies[i].u_amp))
>  			return false;
> -	}
> +
> +		i++;
> +	} while (i < opp_table->regulator_count);
>  
>  	return true;
>  }
> -- 
> 2.19.2
> 

  reply	other threads:[~2018-12-10 11:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 11:32 [RFC PATCH] PM / OPP: Always expose one supply in debugfs Quentin Perret
2018-12-10 11:54 ` Quentin Perret [this message]
2018-12-11  9:25   ` Viresh Kumar
2018-12-11  9:49     ` Quentin Perret
2018-12-11 11:27       ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181210115410.clyrxhp5plptrf5n@queper01-lin \
    --to=quentin.perret@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=sboyd@kernel.org \
    --cc=vireshk@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox