Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1642971 > unrolled thread

[PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily

Started byViresh Kumar <viresh.kumar@linaro.org>
First post2017-05-17 06:50 +0200
Last post2017-05-23 03:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-17 06:50 +0200
    Re: [PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory  unnecessarily Stephen Boyd <sboyd@codeaurora.org> - 2017-05-23 03:30 +0200

#1642971 — [PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily

FromViresh Kumar <viresh.kumar@linaro.org>
Date2017-05-17 06:50 +0200
Subject[PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily
Message-ID<tHZ4m-6Ti-15@gated-at.bofh.it>
We create "supply-0" debugfs directory even if the device doesn't do
voltage scaling. That looks confusing, as if the regulator is found but
we never managed to get voltage levels for it.

Avoid creating such a directory unnecessarily.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/base/power/opp/debugfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
index 95f433db4ac7..ce6f4832946b 100644
--- a/drivers/base/power/opp/debugfs.c
+++ b/drivers/base/power/opp/debugfs.c
@@ -40,11 +40,11 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
 				      struct dentry *pdentry)
 {
 	struct dentry *d;
-	int i = 0;
+	int i = -1;
 	char *name;
 
 	/* Always create at least supply-0 directory */
-	do {
+	while (++i < opp_table->regulator_count) {
 		name = kasprintf(GFP_KERNEL, "supply-%d", i);
 
 		/* Create per-opp directory */
@@ -70,7 +70,7 @@ 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;
-	} while (++i < opp_table->regulator_count);
+	}
 
 	return true;
 }
-- 
2.13.0.303.g4ebf3021692d

[toc] | [next] | [standalone]


#1647558 — Re: [PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-05-23 03:30 +0200
SubjectRe: [PATCH 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily
Message-ID<tK6O6-4Nz-15@gated-at.bofh.it>
In reply to#1642971
On 05/17, Viresh Kumar wrote:
> We create "supply-0" debugfs directory even if the device doesn't do
> voltage scaling. That looks confusing, as if the regulator is found but
> we never managed to get voltage levels for it.
> 
> Avoid creating such a directory unnecessarily.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/base/power/opp/debugfs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/base/power/opp/debugfs.c b/drivers/base/power/opp/debugfs.c
> index 95f433db4ac7..ce6f4832946b 100644
> --- a/drivers/base/power/opp/debugfs.c
> +++ b/drivers/base/power/opp/debugfs.c
> @@ -40,11 +40,11 @@ static bool opp_debug_create_supplies(struct dev_pm_opp *opp,
>  				      struct dentry *pdentry)
>  {
>  	struct dentry *d;
> -	int i = 0;
> +	int i = -1;
>  	char *name;
>  
>  	/* Always create at least supply-0 directory */

Bad comment.

> -	do {
> +	while (++i < opp_table->regulator_count) {

This is a brain-melting while loop for what should be a for loop.
Please just use a for loop instead of pre-incrementing -1 and
comparing that to the unsigned type of regulator_count. i should
probably be unsigned as well.

I can only assume it was written as a do-while before because we
assumed there was always some voltage to control.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web