浏览代码

regulator: core: don't require a supply when supply_name is specified

Regulator drivers may specify regulator_desc->supply_name which
regulator_register() will use to find the supply node for a regulator.
If no supply was specified in the device tree or the supply has yet
to be registered regulator_register() will fail, deferring the probe
of the regulator.  In the case where no supply node was specified in the
device tree, there is no supply and it is pointless to try and find one
later, so go ahead and add the regulator without the supply.

Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Andrew Bresticker 12 年之前
父节点
当前提交
0f7b87f0ac
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      drivers/regulator/core.c

+ 9 - 1
drivers/regulator/core.c

@@ -3477,7 +3477,14 @@ regulator_register(const struct regulator_desc *regulator_desc,
 
 
 		r = regulator_dev_lookup(dev, supply, &ret);
 		r = regulator_dev_lookup(dev, supply, &ret);
 
 
-		if (!r) {
+		if (ret == -ENODEV) {
+			/*
+			 * No supply was specified for this regulator and
+			 * there will never be one.
+			 */
+			ret = 0;
+			goto add_dev;
+		} else if (!r) {
 			dev_err(dev, "Failed to find supply %s\n", supply);
 			dev_err(dev, "Failed to find supply %s\n", supply);
 			ret = -EPROBE_DEFER;
 			ret = -EPROBE_DEFER;
 			goto scrub;
 			goto scrub;
@@ -3495,6 +3502,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
 		}
 		}
 	}
 	}
 
 
+add_dev:
 	/* add consumers devices */
 	/* add consumers devices */
 	if (init_data) {
 	if (init_data) {
 		for (i = 0; i < init_data->num_consumer_supplies; i++) {
 		for (i = 0; i < init_data->num_consumer_supplies; i++) {