UPSTREAM: regulator: Try to resolve regulators supplies on registration
authorJavier Martinez Canillas <javier@osg.samsung.com>
Wed, 23 Mar 2016 23:59:34 +0000 (20:59 -0300)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commit81f752f858604152aaf9fb819483d0e621208e1e
treec710a9a3cea4809c7af87638428369ea589f3bf5
parent609fbaaee4e5fb6b5d2e0142b8a03a8eced0f92c
UPSTREAM: regulator: Try to resolve regulators supplies on registration

Commit 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
moved the regulator supplies lookup logic from the regulators registration
to the regulators get time.

Unfortunately, that changed the behavior of the regulator core since now a
parent supply with a child regulator marked as always-on, won't be enabled
unless a client driver attempts to get the child regulator during boot.

This patch tries to resolve the parent supply for the already registered
regulators each time that a new regulator is registered. So the regulators
that have child regulators marked as always on will be enabled regardless
if a driver gets the child regulator or not.

That was the behavior before the mentioned commit, since parent supplies
were looked up at regulator registration time instead of during child get.

Since regulator_resolve_supply() checks for rdev->supply, most of the times
it will be a no-op. Errors aren't checked to keep the possible out of order
dependencies which was the motivation for the mentioned commit.

Also, the supply being available will be enforced on regulator get anyways
in case the resolve fails on regulators registration.

Fixes: 6261b06de565 ("regulator: Defer lookup of supply to regulator_get")
Suggested-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: <stable@vger.kernel.org> # 4.1+
(cherry picked from commit 5e3ca2b349b1e2c80b060b51bbf2af37448fad85)

Change-Id: I0e1530a985002c915d7a8e04f56b7f2e1acb60c7
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/regulator/core.c