regulator: core: Use map_voltage_linear_range by default for list_voltage_linear_range
authorAxel Lin <axel.lin@ingics.com>
Sat, 24 May 2014 03:10:43 +0000 (11:10 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 26 May 2014 13:36:55 +0000 (14:36 +0100)
Use map_voltage_linear_range() if list_voltage_linear_range() is in use and
nothing is set.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/core.c

index ba28d29..4766611 100644 (file)
@@ -2322,6 +2322,10 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
                            regulator_list_voltage_linear)
                                ret = regulator_map_voltage_linear(rdev,
                                                                min_uV, max_uV);
+                       else if (rdev->desc->ops->list_voltage ==
+                                regulator_list_voltage_linear_range)
+                               ret = regulator_map_voltage_linear_range(rdev,
+                                                               min_uV, max_uV);
                        else
                                ret = regulator_map_voltage_iterate(rdev,
                                                                min_uV, max_uV);