diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-03-22 09:52:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-03-22 09:52:37 -0700 |
commit | 8c826bd99ad9463f0f7f43738ee880bc1667a050 (patch) | |
tree | f4196f1792f0a6208bc263382d4d57b1e2609a72 | |
parent | 6b571e2676c8c2100c3395cdcb471c5ec6f8f98a (diff) | |
parent | e4ead3cdfd798092288f3a06b405cf98ded6fa10 (diff) | |
download | lwn-8c826bd99ad9463f0f7f43738ee880bc1667a050.tar.gz lwn-8c826bd99ad9463f0f7f43738ee880bc1667a050.zip |
Merge tag 'regulator-fix-v6.9-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator fix from Mark Brown:
"One fix that came in during the merge window, fixing a problem with
bootstrapping the state of exclusive regulators which have a parent
regulator"
* tag 'regulator-fix-v6.9-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
regulator: core: Propagate the regulator state in case of exclusive get
-rw-r--r-- | drivers/regulator/core.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index d019ca6dee9b..dabac9772741 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -2274,6 +2274,17 @@ struct regulator *_regulator_get(struct device *dev, const char *id, if (ret > 0) { rdev->use_count = 1; regulator->enable_count = 1; + + /* Propagate the regulator state to its supply */ + if (rdev->supply) { + ret = regulator_enable(rdev->supply); + if (ret < 0) { + destroy_regulator(regulator); + module_put(rdev->owner); + put_device(&rdev->dev); + return ERR_PTR(ret); + } + } } else { rdev->use_count = 0; regulator->enable_count = 0; |