Skip to contentSkip to conversation

regulator: max1586 - improve the logic of choosing selector

PATCH Applied Axel Lin 4 participants 4 messages Aug 18, 2010 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: max1586 - improve the logic of choosing selector

A little bit improvement in the logic of choosing selector.

---
 drivers/regulator/max1586.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/regulator/max1586.c +6 -6
index 8867c27..559cfa2 100644
@@ -121,14 +121,14 @@ static int max1586_v6_set(struct regulator_dev *rdev, int min_uV, int max_uV)
 	if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV)
 		return -EINVAL;
 
-	if (min_uV >= 3000000)
-		selector = 3;
-	if (min_uV < 3000000)
-		selector = 2;
-	if (min_uV < 2500000)
-		selector = 1;
 	if (min_uV < 1800000)
 		selector = 0;
+	else if (min_uV < 2500000)
+		selector = 1;
+	else if (min_uV < 3000000)
+		selector = 2;
+	else if (min_uV >= 3000000)
+		selector = 3;
 
 	if (max1586_v6_calc_voltage(selector) > max_uV)
 		return -EINVAL;
Signature · 1 line
1.7.2