Skip to contentSkip to conversation

regulator: fixed: Remove WARs for handling of_get_named_gpio() return

PATCH In review Laxman Dewangan 2 participants 6 messages Mar 10, 2016 – Mar 13, 2016 Voltage and current regulator framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: fixed: Remove WARs for handling of_get_named_gpio() return

The GPIO interface of_get_named_gpio() has implemented the proper error returns even EPROBE_DEFER and hence caller need not to implement any WAR for translating the returned error.

Remove the WAR implemented in fixed regulator to handle the return of of_get_named_gpio().

---
As per comment, it is said that patch is already posted. If the patch is active then please add my Tested-by: Laxman Dewangan <[email protected]>

 drivers/regulator/fixed.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/regulator/fixed.c +2 -12
index ff62d69..988a747 100644
@@ -79,18 +79,8 @@ of_get_fixed_voltage_config(struct device *dev,
 		config->enabled_at_boot = true;
 
 	config->gpio = of_get_named_gpio(np, "gpio", 0);
-	/*
-	 * of_get_named_gpio() currently returns ENODEV rather than
-	 * EPROBE_DEFER. This code attempts to be compatible with both
-	 * for now; the ENODEV check can be removed once the API is fixed.
-	 * of_get_named_gpio() doesn't differentiate between a missing
-	 * property (which would be fine here, since the GPIO is optional)
-	 * and some other error. Patches have been posted for both issues.
-	 * Once they are check in, we should replace this with:
-	 * if (config->gpio < 0 && config->gpio != -ENOENT)
-	 */
-	if ((config->gpio == -ENODEV) || (config->gpio == -EPROBE_DEFER))
-		return ERR_PTR(-EPROBE_DEFER);
+	if ((config->gpio < 0) && (config->gpio != -ENOENT))
+		return ERR_PTR(config->gpio);
 
 	of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
 
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 regulator: of: Use of_property_read_u32() for reading min/max

OF interface provides to read the u32 value via standard interface of_property_read_u32(). Use this API to read "regulator-min-microvolts" and "regulator-max-microvolt".

This will make consistent with other property value reads.

---
 drivers/regulator/of_regulator.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/regulator/of_regulator.c +7 -8
index fe2e3344..6b0aa80 100644
@@ -28,7 +28,6 @@ static void of_get_regulation_constraints(struct device_node *np,
 					struct regulator_init_data **init_data,
 					const struct regulator_desc *desc)
 {
-	const __be32 *min_uV, *max_uV;
 	struct regulation_constraints *constraints = &(*init_data)->constraints;
 	struct regulator_state *suspend_state;
 	struct device_node *suspend_np;
@@ -37,18 +36,18 @@ static void of_get_regulation_constraints(struct device_node *np,
 
 	constraints->name = of_get_property(np, "regulator-name", NULL);
 
-	min_uV = of_get_property(np, "regulator-min-microvolt", NULL);
-	if (min_uV)
-		constraints->min_uV = be32_to_cpu(*min_uV);
-	max_uV = of_get_property(np, "regulator-max-microvolt", NULL);
-	if (max_uV)
-		constraints->max_uV = be32_to_cpu(*max_uV);
+	if (!of_property_read_u32(np, "regulator-min-microvolt", &pval))
+		constraints->min_uV = pval;
+
+	if (!of_property_read_u32(np, "regulator-max-microvolt", &pval))
+		constraints->max_uV = pval;
 
 	/* Voltage change possible? */
 	if (constraints->min_uV != constraints->max_uV)
 		constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE;
 	/* Only one voltage?  Then make sure it's set. */
-	if (min_uV && max_uV && constraints->min_uV == constraints->max_uV)
+	if (constraints->min_uV && constraints->max_uV &&
+	    constraints->min_uV == constraints->max_uV)
 		constraints->apply_uV = true;
 
 	if (!of_property_read_u32(np, "regulator-microvolt-offset", &pval))
Signature · 1 line
2.1.4
maintainer
#2 lore raw
In reply to Laxman Dewangan
Quoted 2 lines · Laxman Dewangan

Remove the WAR implemented in fixed regulator to handle the return of of_get_named_gpio().

You need to explain what a WAR is, I suspect it's some nVidia internal term.

#3 lore raw
Quoted 9 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 2 lines · Laxman Dewangan

Remove the WAR implemented in fixed regulator to handle the return of of_get_named_gpio().

You need to explain what a WAR is, I suspect it's some nVidia internal term.

We used term "WAR" as workaround. This we used for special handling in SW for unusual stuff. Probably "Hack" is the more appropriate word.

Should I use "hack" here?

maintainer
#4 lore raw
Quoted 5 lines · Laxman Dewangan
Quoted 2 lines · Mark Brown
Quoted 2 lines

Remove the WAR implemented in fixed regulator to handle the return of of_get_named_gpio().

Quoted 8 lines
Quoted 2 lines

You need to explain what a WAR is, I suspect it's some nVidia internal term.

We used term "WAR" as workaround. This we used for special handling in SW for unusual stuff.
Probably "Hack" is the more appropriate word.

Should I use "hack" here?

What is wrong with "workaround"? Or just generally write the commit message so someone outside nVidia can tell what the commit message means.

#5 lore raw
Quoted 8 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 5 lines · Laxman Dewangan
Quoted 4 lines · Mark Brown
Quoted 2 lines

Remove the WAR implemented in fixed regulator to handle the return of of_get_named_gpio().

You need to explain what a WAR is, I suspect it's some nVidia internal term.

Quoted 7 lines
Quoted 4 lines

We used term "WAR" as workaround. This we used for special handling in SW for unusual stuff.
Probably "Hack" is the more appropriate word.
Should I use "hack" here?

What is wrong with "workaround"? Or just generally write the commit message so someone outside nVidia can tell what the commit message means.

OK, will send the patch with term "workaround".