diff options
author | Enric Balletbo i Serra <enric.balletbo@collabora.com> | 2020-01-16 10:45:43 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-01-17 15:32:27 +0000 |
commit | e9153311491da9d9863ead9888a1613531cb4a1b (patch) | |
tree | 9e3e3aac08fb36828067dbc508d2e243906f5b4d /drivers/regulator/core.c | |
parent | 6f1ff76154b8b36033efcbf6453a71a3d28f52cd (diff) | |
download | linux-stable-e9153311491da9d9863ead9888a1613531cb4a1b.tar.gz linux-stable-e9153311491da9d9863ead9888a1613531cb4a1b.tar.bz2 linux-stable-e9153311491da9d9863ead9888a1613531cb4a1b.zip |
regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage
`cat /sys/kernel/debug/regulator/regulator_summary` ends on a deadlock
when you have a voltage controlled regulator (vctrl).
The problem is that the vctrl_get_voltage() and vctrl_set_voltage() calls the
regulator_get_voltage() and regulator_set_voltage() and that will try to lock
again the dependent regulators (the regulator supplying the control voltage).
Fix the issue by exporting the unlocked version of the regulator_get_voltage()
and regulator_set_voltage() API so drivers that need it, like the voltage
controlled regulator driver can use it.
Fixes: f8702f9e4aa7 ("regulator: core: Use ww_mutex for regulators locking")
Reported-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Link: https://lore.kernel.org/r/20200116094543.2847321-1-enric.balletbo@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 2961ac08d1ae..6be687d25484 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3466,6 +3466,7 @@ int regulator_set_voltage_rdev(struct regulator_dev *rdev, int min_uV, out: return ret; } +EXPORT_SYMBOL(regulator_set_voltage_rdev); static int regulator_limit_voltage_step(struct regulator_dev *rdev, int *current_uV, int *min_uV) @@ -4030,6 +4031,7 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev) return ret; return ret - rdev->constraints->uV_offset; } +EXPORT_SYMBOL(regulator_get_voltage_rdev); /** * regulator_get_voltage - get regulator output voltage |