Commit 3d67fe95 authored by Maciej Purski's avatar Maciej Purski Committed by Mark Brown

regulator: core: Refactor regulator_list_voltage()

Change _regulator_list_voltage() argument from regulator to
regulator_dev in order to provide better separation of core layers.
Allow calling _regulator_list_voltage() from functions, with
regulator_dev argument. This refactoring is needed in order to
implement setting voltage of coupled regulators.
Signed-off-by: default avatarMaciej Purski <m.purski@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 148096af
...@@ -2447,10 +2447,9 @@ static int _regulator_is_enabled(struct regulator_dev *rdev) ...@@ -2447,10 +2447,9 @@ static int _regulator_is_enabled(struct regulator_dev *rdev)
return rdev->desc->ops->is_enabled(rdev); return rdev->desc->ops->is_enabled(rdev);
} }
static int _regulator_list_voltage(struct regulator *regulator, static int _regulator_list_voltage(struct regulator_dev *rdev,
unsigned selector, int lock) unsigned selector, int lock)
{ {
struct regulator_dev *rdev = regulator->rdev;
const struct regulator_ops *ops = rdev->desc->ops; const struct regulator_ops *ops = rdev->desc->ops;
int ret; int ret;
...@@ -2466,7 +2465,8 @@ static int _regulator_list_voltage(struct regulator *regulator, ...@@ -2466,7 +2465,8 @@ static int _regulator_list_voltage(struct regulator *regulator,
if (lock) if (lock)
mutex_unlock(&rdev->mutex); mutex_unlock(&rdev->mutex);
} else if (rdev->is_switch && rdev->supply) { } else if (rdev->is_switch && rdev->supply) {
ret = _regulator_list_voltage(rdev->supply, selector, lock); ret = _regulator_list_voltage(rdev->supply->rdev,
selector, lock);
} else { } else {
return -EINVAL; return -EINVAL;
} }
...@@ -2542,7 +2542,7 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages); ...@@ -2542,7 +2542,7 @@ EXPORT_SYMBOL_GPL(regulator_count_voltages);
*/ */
int regulator_list_voltage(struct regulator *regulator, unsigned selector) int regulator_list_voltage(struct regulator *regulator, unsigned selector)
{ {
return _regulator_list_voltage(regulator, selector, 1); return _regulator_list_voltage(regulator->rdev, selector, 1);
} }
EXPORT_SYMBOL_GPL(regulator_list_voltage); EXPORT_SYMBOL_GPL(regulator_list_voltage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment