Messages in this thread Patch in this message | | | From | Marco Felsch <> | Subject | [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage | Date | Tue, 17 Sep 2019 17:40:19 +0200 |
| |
Since commit 1fc12b05895e ("regulator: core: Avoid propagating to supplies when possible") regulators marked with boot-on can't be disabled anymore because the commit handles always-on and boot-on regulators the same way.
Now commit 05f224ca6693 ("regulator: core: Clean enabling always-on regulators + their supplies") changed the regulator_resolve_supply() logic a bit by using 'use_count'. So we can't just skip the 'use_count++' during set_machine_constraints(). The easiest way I found is to correct the 'use_count' just before returning the rdev device during regulator_register().
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- drivers/regulator/core.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e0c0cf462004..f9444f509440 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -5170,6 +5170,11 @@ regulator_register(const struct regulator_desc *regulator_desc, /* try to resolve regulators supply since a new one was registered */ class_for_each_device(®ulator_class, NULL, NULL, regulator_register_resolve_supply); + + /* cleanup use_count -> boot-on marked regulators can be disabled */ + if (rdev->constraints->boot_on && !rdev->constraints->always_on) + rdev->use_count--; + kfree(config); return rdev; -- 2.20.1
| |