Skip to content

Commit aea6cb9

Browse files
osctobebroonie
authored andcommitted
regulator: resolve supply after creating regulator
When creating a new regulator its supply cannot create the sysfs link because the device is not yet published. Remove early supply resolving since it will be done later anyway. This makes the following error disappear and the symlinks get created instead. DCDC_REG1: supplied by VSYS VSYS: could not add device link regulator.3 err -2 Note: It doesn't fix the problem for bypassed regulators, though. Fixes: 45389c4 ("regulator: core: Add early supply resolution for regulators") Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/ba09e0a8617ffeeb25cb4affffe6f3149319cef8.1601155770.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 61aab5a commit aea6cb9

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

drivers/regulator/core.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5280,15 +5280,20 @@ regulator_register(const struct regulator_desc *regulator_desc,
52805280
else if (regulator_desc->supply_name)
52815281
rdev->supply_name = regulator_desc->supply_name;
52825282

5283-
/*
5284-
* Attempt to resolve the regulator supply, if specified,
5285-
* but don't return an error if we fail because we will try
5286-
* to resolve it again later as more regulators are added.
5287-
*/
5288-
if (regulator_resolve_supply(rdev))
5289-
rdev_dbg(rdev, "unable to resolve supply\n");
5290-
52915283
ret = set_machine_constraints(rdev, constraints);
5284+
if (ret == -EPROBE_DEFER) {
5285+
/* Regulator might be in bypass mode and so needs its supply
5286+
* to set the constraints */
5287+
/* FIXME: this currently triggers a chicken-and-egg problem
5288+
* when creating -SUPPLY symlink in sysfs to a regulator
5289+
* that is just being created */
5290+
ret = regulator_resolve_supply(rdev);
5291+
if (!ret)
5292+
ret = set_machine_constraints(rdev, constraints);
5293+
else
5294+
rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
5295+
ERR_PTR(ret));
5296+
}
52925297
if (ret < 0)
52935298
goto wash;
52945299

0 commit comments

Comments
 (0)