Skip to contentSkip to conversation

regulator: Fix default constraints for fixed voltage regulators

PATCH Applied Mark Brown 2 participants 2 messages Apr 28, 2009 Voltage and current regulator framework

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 regulator: Fix default constraints for fixed voltage regulators

Default voltage constraints were being provided for fixed voltage regulator where board constraints were not provided but these constraints used INT_MIN as the default minimum voltage which is not a valid value since it is less than zero. Use 1uV instead.

Also set the default values we set in the constraints themselves since otherwise the max_uV constraint we determine will not be stored in the actual constraint strucutre and will therefore not be used.

---
 drivers/regulator/core.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/regulator/core.c +5 -2
index 01f7702..dccf94d 100644
@@ -703,10 +703,13 @@ static int set_machine_constraints(struct regulator_dev *rdev,
 		int	cmin = constraints->min_uV;
 		int	cmax = constraints->max_uV;
 
-		/* it's safe to autoconfigure fixed-voltage supplies */
+		/* it's safe to autoconfigure fixed-voltage supplies
+		   and the constraints are used by list_voltage. */
 		if (count == 1 && !cmin) {
-			cmin = INT_MIN;
+			cmin = 1;
 			cmax = INT_MAX;
+			constraints->min_uV = cmin;
+			constraints->max_uV = cmax;
 		}
 
 		/* voltage constraints are optional */
Signature · 1 line
1.6.2.4
#1 lore raw
Quoted 5 lines · Mark Brown

Default voltage constraints were being provided for fixed voltage regulator where board constraints were not provided but these constraints used INT_MIN as the default minimum voltage which is not a valid value since it is less than zero. Use 1uV instead.

Quoted 8 lines

Also set the default values we set in the constraints themselves since otherwise the max_uV constraint we determine will not be stored in the actual constraint strucutre and will therefore not be used.

---
 drivers/regulator/core.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

Applied.

Thanks

Liam