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


Groups > linux.kernel > #1647617

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

From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject [PATCH V2 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily
Date 2017-05-23 06:10 +0200
Message-ID <tK9iV-6tR-13@gated-at.bofh.it> (permalink)
References <tK9iV-6tR-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

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

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH V2 0/4] PM / OPP: Minor cleanups Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-23 06:10 +0200
  [PATCH V2 1/4] PM / OPP: Reorganize _generic_set_opp_regulator() Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-23 06:10 +0200
    [PATCH V2 4/4] PM / OPP: Don't create debugfs "supply-0" directory unnecessarily Viresh Kumar <viresh.kumar@linaro.org> - 2017-05-23 06:10 +0200
      Re: [PATCH V2 4/4] PM / OPP: Don't create debugfs "supply-0"  directory unnecessarily Stephen Boyd <sboyd@codeaurora.org> - 2017-05-23 23:20 +0200

csiph-web