summaryrefslogtreecommitdiff
path: root/include/linux/regulator/driver.h
diff options
context:
space:
mode:
authorMaciej Purski <m.purski@samsung.com>2018-04-23 16:33:37 +0200
committerMark Brown <broonie@kernel.org>2018-05-17 16:05:03 +0900
commit66cf9a7e0192734c1c94751e628bd075be62cff4 (patch)
treebd032804bb4f2cd5c17ab66c3da7b6e69ace45b8 /include/linux/regulator/driver.h
parent0369e02b75e6381f892e3bd45f1d8d6330d855fb (diff)
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.h2
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;