]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
regulator: core: Use map_voltage_linear() if list_voltage_linear() is in use and...
authorAxel Lin <axel.lin@gmail.com>
Mon, 4 Jun 2012 01:41:38 +0000 (09:41 +0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 4 Jun 2012 09:48:18 +0000 (10:48 +0100)
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c

index 8521e0d6b3bc0f17a1c12da1cce2dfbc2968d56b..3cbe3129ed3b740e2f8b8aad2bb7ea19c0bc1af7 100644 (file)
@@ -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;