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

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: NJohn Stultz <john.stultz@linaro.org>
Tested-by: NJohn Stultz <john.stultz@linaro.org>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 fc42112c
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册