Skip to contentSkip to conversation

PM / OPP: Fix parsing of opp-microvolt and opp-microamp properties

PATCH Superseded Bartlomiej Zolnierkiewicz 2 participants 2 messages Dec 16, 2015 – Dec 17, 2015

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / OPP: Fix parsing of opp-microvolt and opp-microamp properties

Commit 01fb4d3c39d3 ("PM / OPP: Parse 'opp-<prop>-<name>' bindings") broke support for parsing standard opp-microvolt and opp-microamp properties. Fix it by setting 'name' string to proper value for !dev_opp->prop_name cases.

Cc Viresh Kumar <[email protected]>
Cc Lee Jones <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Fixes 01fb4d3c39d3 ("PM / OPP: Parse 'opp-<prop>-<name> 'bindings")

---
This fixes Exynos4x12 cpufreq-dt support regression present in linux-pm/linux-next tree. Rafael, please apply. Thank you.

 drivers/base/power/opp/core.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/base/power/opp/core.c +6 -6
Index: b/drivers/base/power/opp/core.c
===================================================================
@@ -806,11 +806,11 @@ static int opp_parse_supplies(struct dev
 	struct property *prop = NULL;
 	char name[NAME_MAX];
 
+	sprintf(name, "opp-microvolt-%s", dev_opp->prop_name);
+
 	/* Search for "opp-microvolt-<name>" */
-	if (dev_opp->prop_name) {
-		sprintf(name, "opp-microvolt-%s", dev_opp->prop_name);
+	if (dev_opp->prop_name)
 		prop = of_find_property(opp->np, name, NULL);
-	}
 
 	if (!prop) {
 		/* Search for "opp-microvolt" */
@@ -848,10 +848,10 @@ static int opp_parse_supplies(struct dev
 
 	/* Search for "opp-microamp-<name>" */
 	prop = NULL;
-	if (dev_opp->prop_name) {
-		sprintf(name, "opp-microamp-%s", dev_opp->prop_name);
+	sprintf(name, "opp-microamp-%s", dev_opp->prop_name);
+
+	if (dev_opp->prop_name)
 		prop = of_find_property(opp->np, name, NULL);
-	}
 
 	if (!prop) {
 		/* Search for "opp-microamp" */
#1 lore raw
Quoted 40 lines · Bartlomiej Zolnierkiewicz

Commit 01fb4d3c39d3 ("PM / OPP: Parse 'opp-<prop>-<name>' bindings") broke support for parsing standard opp-microvolt and opp-microamp properties. Fix it by setting 'name' string to proper value for !dev_opp->prop_name cases.

Cc Viresh Kumar <[email protected]>
Cc Lee Jones <[email protected]>
Cc Rafael J. Wysocki <[email protected]>
Fixes 01fb4d3c39d3 ("PM / OPP: Parse 'opp-<prop>-<name> 'bindings")

---
This fixes Exynos4x12 cpufreq-dt support regression present in linux-pm/linux-next tree. Rafael, please apply. Thank you.

 drivers/base/power/opp/core.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Index: b/drivers/base/power/opp/core.c
===================================================================

drivers/base/power/opp/core.c +3 -3
@@ -806,11 +806,11 @@ static int opp_parse_supplies(struct dev
 	struct property *prop = NULL;
 	char name[NAME_MAX];
 
+	sprintf(name, "opp-microvolt-%s", dev_opp->prop_name);
+
 	/* Search for "opp-microvolt-<name>" */
-	if (dev_opp->prop_name) {
-		sprintf(name, "opp-microvolt-%s", dev_opp->prop_name);
+	if (dev_opp->prop_name)
 		prop = of_find_property(opp->np, name, NULL);
-	}
 
 	if (!prop) {
 		/* Search for "opp-microvolt" */
@@ -848,10 +848,10 @@ static int opp_parse_supplies(struct dev
 
 	/* Search for "opp-microamp-<name>" */
 	prop = NULL;

drivers/base/power/opp/core.c static int opp_parse_supplies(struct dev · line 857

Quoted 10 lines
drivers/base/power/opp/core.c +3 -3
-	if (dev_opp->prop_name) {
-		sprintf(name, "opp-microamp-%s", dev_opp->prop_name);
+	sprintf(name, "opp-microamp-%s", dev_opp->prop_name);
+
+	if (dev_opp->prop_name)
 		prop = of_find_property(opp->np, name, NULL);
-	}
 
 	if (!prop) {
 		/* Search for "opp-microamp" */

Sorry about this. And I am disliking the solution suggested by Stephen more and more now. Please resend this patch with following changes instead:

drivers/base/power/opp/core.c +2 -2
index 6c6856e426f0..a96df5cda303 100644
@@ -816,7 +816,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
 
        if (!prop) {
                /* Search for "opp-microvolt" */
-               name[13] = '\0';
+               sprintf(name, "opp-microvolt");
                prop = of_find_property(opp->np, name, NULL);
 
                /* Missing property isn't a problem, but an invalid entry is */
@@ -857,7 +857,7 @@ static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
 
        if (!prop) {
                /* Search for "opp-microamp" */
-               name[12] = '\0';
+               sprintf(name, "opp-microamp");
                prop = of_find_property(opp->np, name, NULL);
        }
 
Signature · 1 line
viresh