]> git.baikalelectronics.ru Git - kernel.git/commit
regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Thu, 16 Jan 2020 09:45:43 +0000 (10:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:52 +0000 (08:36 +0100)
commit8001ab87ddeddf0909d64d0e9d294ce3c3326d2a
treeb21b4180421a404e8d07ec94c4fe07fec7f76d01
parent475ed3534606d4b252adea22b27fa2a47c1406f3
regulator: vctrl-regulator: Avoid deadlock getting and setting the voltage

[ Upstream commit 8168a596145c2c2d3165499baaa4d69413be51a9 ]

`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: 34d9ea2d0ce3 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/regulator/core.c
drivers/regulator/vctrl-regulator.c