mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
regulator: core: Propagate the regulator state in case of exclusive get
Previously, performing an exclusive get on an already-enabled regulator resulted in inconsistent state initialization between child and parent regulators. While the child's counts were updated, its parent's counters remained unaffected. Consequently, attempting to disable an already-enabled exclusive regulator triggered unbalanced disables warnings from its parent regulator. This commit addresses the issue by propagating the enable state to the parent regulator using a regulator_enable call. This ensures consistent state management across the regulator hierarchy, preventing warnings! Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Link: https://msgid.link/r/20240312091638.1266167-1-kory.maincent@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
e6f0b08a03
commit
e4ead3cdfd
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user