diff options
author | Maciej Purski <m.purski@samsung.com> | 2018-04-23 17:33:37 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-05-17 10:05:03 +0300 |
commit | 66cf9a7e0192734c1c94751e628bd075be62cff4 (patch) | |
tree | bd032804bb4f2cd5c17ab66c3da7b6e69ace45b8 /include/linux/regulator/driver.h | |
parent | 0369e02b75e6381f892e3bd45f1d8d6330d855fb (diff) | |
download | linux-66cf9a7e0192734c1c94751e628bd075be62cff4.tar.xz |
regulator: core: Make locks re-entrant
Setting voltage, enabling/disabling regulators requires operations on
all regulators related with the regulator being changed. Therefore,
all of them should be locked for the whole operation. With the current
locking implementation, adding additional dependency (regulators
coupling) causes deadlocks in some cases.
Introduce a possibility to attempt to lock a mutex multiple times
by the same task without waiting on a mutex. This should handle all
reasonable coupling-supplying combinations, especially when two coupled
regulators share common supplies. The only situation that should be
forbidden is simultaneous coupling and supplying between a pair of
regulators.
The idea is based on clk core.
Signed-off-by: Maciej Purski <m.purski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/regulator/driver.h')
-rw-r--r-- | include/linux/regulator/driver.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h index 14e512ad6d4f..c2a181fa7287 100644 --- a/include/linux/regulator/driver.h +++ b/include/linux/regulator/driver.h @@ -434,6 +434,8 @@ struct regulator_dev { struct blocking_notifier_head notifier; struct mutex mutex; /* consumer lock */ + struct task_struct *mutex_owner; + int ref_cnt; struct module *owner; struct device dev; struct regulation_constraints *constraints; |