summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-11-03 06:58:14 +0100
committerMark Brown <broonie@kernel.org>2015-11-04 11:16:05 +0100
commitd9b96d35d2521342fdbcbc7468a0f7dcfaba4147 (patch)
tree43e895d5a496cc63f4ad04e2b9724068a6495004 /drivers/regulator
parentregulator: core: Propagate voltage changes to supply regulators (diff)
downloadlinux-d9b96d35d2521342fdbcbc7468a0f7dcfaba4147.tar.xz
linux-d9b96d35d2521342fdbcbc7468a0f7dcfaba4147.zip
regulator: Use regulator_lock_supply() for get_voltage() too
Since we need to read voltages of parents as part of setting supply voltages we need to be able to do get_voltage() internally without taking locks so reorganize the locking to take locks on the full tree on entry rather than as we recurse when called externally. Reported-by: John Stultz <john.stultz@linaro.org> Tested-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 771c6235cced..b4970eb85357 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3055,7 +3055,7 @@ static int _regulator_get_voltage(struct regulator_dev *rdev)
} else if (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1)) {
ret = rdev->desc->fixed_uV;
} else if (rdev->supply) {
- ret = regulator_get_voltage(rdev->supply);
+ ret = _regulator_get_voltage(rdev->supply->rdev);
} else {
return -EINVAL;
}
@@ -3078,11 +3078,11 @@ int regulator_get_voltage(struct regulator *regulator)
{
int ret;
- mutex_lock(&regulator->rdev->mutex);
+ regulator_lock_supply(regulator->rdev);
ret = _regulator_get_voltage(regulator->rdev);
- mutex_unlock(&regulator->rdev->mutex);
+ regulator_unlock_supply(regulator->rdev);
return ret;
}