[U-Boot] [PATCH] power: extend prefix match to regulator-name property

Felix Brack fb at ltec.ch
Mon Oct 9 10:04:40 UTC 2017


This patch extends pmic_bind_children prefix matching. In addition to
the node name the property regulator-name is used while trying to match
prefixes. This allows assigning different drivers to regulator nodes
named regulator at 1 and regulator at 10 for example.
Signed-off-by: Felix Brack <fb at ltec.ch>
---

 drivers/power/pmic/pmic-uclass.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index 64964e4..5a034f0 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -26,6 +26,7 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
 	struct driver *drv;
 	struct udevice *child;
 	const char *node_name;
+	const char *reg_name;
 	int bind_count = 0;
 	ofnode node;
 	int prefix_len;
@@ -44,8 +45,18 @@ int pmic_bind_children(struct udevice *pmic, ofnode parent,
 			debug("  - compatible prefix: '%s'\n", info->prefix);
 
 			prefix_len = strlen(info->prefix);
-			if (strncmp(info->prefix, node_name, prefix_len))
-				continue;
+			if (strncmp(info->prefix, node_name, prefix_len)) {
+				reg_name = ofnode_read_string(node,
+							      "regulator-name");
+				if (reg_name) {
+					if (strncmp(info->prefix, reg_name,
+						    prefix_len)) {
+						continue;
+					}
+				} else {
+					continue;
+				}
+			}
 
 			drv = lists_driver_lookup_name(info->driver);
 			if (!drv) {
-- 
2.7.4



More information about the U-Boot mailing list