Skip to contentSkip to conversation

regulator: core: Use map_voltage_linear() if list_voltage_linear() is in use and nothing is set

PATCH Applied Axel Lin 2 participants 2 messages Jun 4, 2012 Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 regulator: core: Use map_voltage_linear() if list_voltage_linear() is in use and nothing is set

---
 drivers/regulator/core.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/regulator/core.c +10 -4
index 8521e0d..3cbe312 100644
@@ -2118,12 +2118,18 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 		ret = rdev->desc->ops->set_voltage(rdev, min_uV, max_uV,
 						   &selector);
 	} else if (rdev->desc->ops->set_voltage_sel) {
-		if (rdev->desc->ops->map_voltage)
+		if (rdev->desc->ops->map_voltage) {
 			ret = rdev->desc->ops->map_voltage(rdev, min_uV,
 							   max_uV);
-		else
-			ret = regulator_map_voltage_iterate(rdev, min_uV,
-							    max_uV);
+		} else {
+			if (rdev->desc->ops->list_voltage ==
+			    regulator_list_voltage_linear)
+				ret = regulator_map_voltage_linear(rdev,
+								min_uV, max_uV);
+			else
+				ret = regulator_map_voltage_iterate(rdev,
+								min_uV, max_uV);
+		}
 
 		if (ret >= 0) {
 			selector = ret;
Signature · 1 line
1.7.9.5