This is a note to let you know that I've just added the patch titled regulator: core: Resolve supplies before disabling unused regulators to the 4.9-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: regulator-core-resolve-supplies-before-disabling-unused-regulators.patch and it can be found in the queue-4.9 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Thu Oct 19 15:04:02 CEST 2017 From: Javier Martinez Canillas <javier@xxxxxxxxxxxxxxx> Date: Thu, 16 Feb 2017 14:30:02 -0300 Subject: regulator: core: Resolve supplies before disabling unused regulators From: Javier Martinez Canillas <javier@xxxxxxxxxxxxxxx> [ Upstream commit 3827b64dba27ebadb4faf51f2c91143e01ba1f6d ] After commit 66d228a2bf03 ("regulator: core: Don't use regulators as supplies until the parent is bound"), input supplies aren't resolved if the input supplies parent device has not been bound. This prevent regulators to hold an invalid reference if its supply parent device driver probe is deferred. But this causes issues on some boards where a PMIC's regulator use as input supply a regulator from another PMIC whose driver is registered after the driver for the former. In this case the regulators for the first PMIC will fail to resolve input supplies on regulators registration (since the other PMIC wasn't probed yet). And when the core attempts to resolve again latter when the other PMIC registers its own regulators, it will fail again since the parent device isn't bound yet. This will cause some parent supplies to never be resolved and wrongly be disabled on boot due taking them as unused. To solve this problem, also attempt to resolve the pending regulators input supplies before disabling the unused regulators. Signed-off-by: Javier Martinez Canillas <javier@xxxxxxxxxxxxxxx> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/regulator/core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4507,6 +4507,16 @@ static int __init regulator_init_complet if (of_have_populated_dt()) has_full_constraints = true; + /* + * Regulators may had failed to resolve their input supplies + * when were registered, either because the input supply was + * not registered yet or because its parent device was not + * bound yet. So attempt to resolve the input supplies for + * pending regulators before trying to disable unused ones. + */ + class_for_each_device(®ulator_class, NULL, NULL, + regulator_register_resolve_supply); + /* If we have a full configuration then disable any regulators * we have permission to change the status for and which are * not in use or always_on. This is effectively the default Patches currently in stable-queue which might be from javier@xxxxxxxxxxxxxxx are queue-4.9/regulator-core-resolve-supplies-before-disabling-unused-regulators.patch