clk: qcom: gdsc-regulator: Remove regulator_lock() call from GDSC driver
Remove regulator_lock() and regulator_is_enabled() calls in GDSC driver
as they are resulting in deadlock cases when lockdep is enabled. But it
is critical to check if parent is enabled or not before performing any
GDSC operation, as GDSC register access requires parent to be enabled.
Use the parent's use_count to check if parent is enabled or not. For
gdsc_disable(), in most cases, parent's mutex is locked by regulator
framework before calling the gdsc_disable() callback, hence it is safe
to read use_count. But in code paths where parent lock is not acquired
by regulator framework, acquire parent's mutex before reading use_count
to avoid parent getting disabled while in the middle of GDSC operations.
For gdsc_set_mode(), parent locking is needed to avoid parent getting
disabled in the middle of set mode operation. But it does not need the
per-process reentrancy provided by regulator_lock() and regulator_unlock().
Therefore replace the calls with ww_mutex_lock() and ww_mutex_unlock().
Change-Id: Ic20f9a7478b47c9fde2e686b68d636342a4b1d48
Signed-off-by:
Jagadeesh Kona <jkona@codeaurora.org>
Loading
Please register or sign in to comment