提交 f7df20ec 编写于 作者: M Mark Brown

regulator: core: Use list_voltage() to read single voltage regulators

If the regulator doesn't supply a way of reading back the voltage but does
provide a list_voltage() operation then use that with a selector of zero
to read the voltage.  Regulators doing this means that we have the list
operation there for consumers that want to configure themselves.
Reported-by: NStephen Warren <swarren@wwwdotorg.org>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 215b8b05
...@@ -2395,6 +2395,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev) ...@@ -2395,6 +2395,8 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
ret = rdev->desc->ops->list_voltage(rdev, sel); ret = rdev->desc->ops->list_voltage(rdev, sel);
} else if (rdev->desc->ops->get_voltage) { } else if (rdev->desc->ops->get_voltage) {
ret = rdev->desc->ops->get_voltage(rdev); ret = rdev->desc->ops->get_voltage(rdev);
} else if (rdev->desc->ops->list_voltage) {
ret = rdev->desc->ops->list_voltage(rdev, 0);
} else { } else {
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册