Skip to contentSkip to conversation

power: regulator: scmi: Move regulator subnode hack to scmi_regulator

PATCH In review Marek Vasut 3 participants 7 messages Mar 22, 2025 – Apr 23, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: regulator: scmi: Move regulator subnode hack to scmi_regulator

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to its subnodes.

Fixes 1f213ee4dbf2 ("firmware: scmi: voltage regulator")

---
Cc: Alice Guo <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 drivers/firmware/scmi/scmi_agent-uclass.c | 8 +-------
 drivers/power/regulator/scmi_regulator.c  | 6 ++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/firmware/scmi/scmi_agent-uclass.c +1 -7
index 8c907c3b032..e6e43ae936a 100644
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
 			break;
 		case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
 			if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI) &&
-			    scmi_protocol_is_supported(dev, protocol_id)) {
-				node = ofnode_find_subnode(node, "regulators");
-				if (!ofnode_valid(node)) {
-					dev_err(dev, "no regulators node\n");
-					return -ENXIO;
-				}
+			    scmi_protocol_is_supported(dev, protocol_id))
 				drv = DM_DRIVER_GET(scmi_voltage_domain);
-			}
 			break;
 		default:
 			break;
drivers/power/regulator/scmi_regulator.c +6 -0
index 99f6506f162..2550b27246f 100644
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
 	ofnode node;
 	int ret;
 
+	node = ofnode_find_subnode(node, "regulators");
+	if (!ofnode_valid(node)) {
+		dev_err(dev, "no regulators node\n");
+		return -ENXIO;
+	}
+
 	drv = DM_DRIVER_GET(scmi_regulator);
 
 	ofnode_for_each_subnode(node, dev_ofnode(dev)) {
Signature · 1 line
2.47.2
#1 lore raw
Quoted 80 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年3月22日 9:45
收件人: [email protected]
抄送: Marek Vasut <[email protected]>; Alice Guo <[email protected]>; Ilias Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]>
主题: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to its subnodes.

Fixes 1f213ee4dbf2 ("firmware: scmi: voltage regulator")

---
Cc: Alice Guo <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
 drivers/firmware/scmi/scmi_agent-uclass.c | 8 +-------
drivers/power/regulator/scmi_regulator.c  | 6 ++++++
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/firmware/scmi/scmi_agent-uclass.c +0 -0
index 8c907c3b032..e6e43ae936a 100644
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
                        break;
                case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
                        if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)

&&
- scmi_protocol_is_supported(dev, protocol_id))
{
- node = ofnode_find_subnode(node,
"regulators");

drivers/firmware/scmi/scmi_agent-uclass.c +0 -2
-                               if (!ofnode_valid(node)) {
-                                       dev_err(dev, "no regulators

node\n");

drivers/firmware/scmi/scmi_agent-uclass.c +2 -2
-                                       return -ENXIO;
-                               }
+                           scmi_protocol_is_supported(dev,
+ protocol_id))
                                drv =

DM_DRIVER_GET(scmi_voltage_domain);

drivers/firmware/scmi/scmi_agent-uclass.c +0 -1
-                       }
                        break;
                default:
                        break;
drivers/power/regulator/scmi_regulator.c +6 -1
index 99f6506f162..2550b27246f 100644
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
        ofnode node;
        int ret;
 
+       node = ofnode_find_subnode(node, "regulators");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "no regulators node\n");
+               return -ENXIO;
+       }
+
        drv = DM_DRIVER_GET(scmi_regulator);
 
        ofnode_for_each_subnode(node, dev_ofnode(dev)) {
--
Quoted 1 line

2.47.2

Hi Marek,

Is there a problem in your patch? Should it be changed like this:

drivers/power/regulator/scmi_regulator.c +8 -1
@@ -175,12 +175,19 @@ U_BOOT_DRIVER(scmi_regulator) = {
 static int scmi_regulator_bind(struct udevice *dev)
 {
        struct driver *drv;
+       ofnode regul_node;
        ofnode node;
        int ret;
 
+       regul_node = ofnode_find_subnode(dev_ofnode(dev), "regulators");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "no regulators node\n");
+               return -ENXIO;
+       }
+
        drv = DM_DRIVER_GET(scmi_regulator);
 
-       ofnode_for_each_subnode(node, dev_ofnode(dev)) {
+       ofnode_for_each_subnode(node, regul_node) {
                ret = device_bind(dev, drv, ofnode_get_name(node),
                                  NULL, node, NULL);
                if (ret)

Best Regards,
Alice Guo

#2 lore raw
Quoted 78 lines · Alice Guo (OSS)
Quoted 78 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年3月22日 9:45
收件人: [email protected]
抄送: Marek Vasut <[email protected]>; Alice Guo <[email protected]>; Ilias Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]>
主题: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to its subnodes.

Fixes 1f213ee4dbf2 ("firmware: scmi: voltage regulator")

---
Cc: Alice Guo <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
  drivers/firmware/scmi/scmi_agent-uclass.c | 8 +-------
drivers/power/regulator/scmi_regulator.c  | 6 ++++++
  2 files changed, 7 insertions(+), 7 deletions(-)
drivers/firmware/scmi/scmi_agent-uclass.c +0 -0
index 8c907c3b032..e6e43ae936a 100644
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
                         break;
                 case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
                         if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)

&&
- scmi_protocol_is_supported(dev, protocol_id))
{
- node = ofnode_find_subnode(node,
"regulators");

drivers/firmware/scmi/scmi_agent-uclass.c +0 -2
-                               if (!ofnode_valid(node)) {
-                                       dev_err(dev, "no regulators

node\n");

drivers/firmware/scmi/scmi_agent-uclass.c +2 -2
-                                       return -ENXIO;
-                               }
+                           scmi_protocol_is_supported(dev,
+ protocol_id))
                                 drv =

DM_DRIVER_GET(scmi_voltage_domain);

drivers/firmware/scmi/scmi_agent-uclass.c +0 -1
-                       }
                         break;
                 default:
                         break;
drivers/power/regulator/scmi_regulator.c +6 -0
index 99f6506f162..2550b27246f 100644
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
         ofnode node;
         int ret;
 
+       node = ofnode_find_subnode(node, "regulators");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "no regulators node\n");
+               return -ENXIO;
+       }
+
         drv = DM_DRIVER_GET(scmi_regulator);
 
Quoted 7 lines
Quoted 3 lines
drivers/power/regulator/scmi_regulator.c +0 -1
         ofnode_for_each_subnode(node, dev_ofnode(dev)) {
--

2.47.2

Hi Marek,

Is there a problem in your patch? Should it be changed like this:

What kind of problem ? Can you please elaborate ?

#3 lore raw
Quoted 94 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年4月9日 2:31
收件人: Alice Guo (OSS) <[email protected]>; [email protected] 抄送: Alice Guo <[email protected]>; Ilias Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]>
主题: Re: 回复: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Quoted 5 lines · Alice Guo (OSS)
Quoted 5 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年3月22日 9:45
收件人: [email protected]
抄送: Marek Vasut <[email protected]>; Alice Guo <[email protected]>;

Ilias

Quoted 10 lines
Quoted 10 lines

Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]> 主题: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 5 lines
Quoted 5 lines

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to

its subnodes.

Quoted 14 lines
Quoted 14 lines
Fixes 1f213ee4dbf2 ("firmware: scmi: voltage regulator")

---
Cc: Alice Guo <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
  drivers/firmware/scmi/scmi_agent-uclass.c | 8 +-------
drivers/power/regulator/scmi_regulator.c  | 6 ++++++
  2 files changed, 7 insertions(+), 7 deletions(-)
Quoted 9 lines

drivers/firmware/scmi/scmi_agent-uclass.c static int scmi_bind_protocols(struct udevice *dev) · line 429

Quoted 9 lines
drivers/firmware/scmi/scmi_agent-uclass.c +0 -0
index 8c907c3b032..e6e43ae936a 100644
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
                         break;
                 case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
                         if

(IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)

Quoted 2 lines
Quoted 2 lines

&&
- scmi_protocol_is_supported(dev,

protocol_id))

Quoted 5 lines

drivers/firmware/scmi/scmi_agent-uclass.c

Quoted 5 lines

{
- node = ofnode_find_subnode(node,
"regulators");

drivers/firmware/scmi/scmi_agent-uclass.c +0 -2
-                               if (!ofnode_valid(node)) {
-                                       dev_err(dev, "no

regulators

Quoted 28 lines
Quoted 28 lines

node\n");

drivers/firmware/scmi/scmi_agent-uclass.c +2 -2
-                                       return -ENXIO;
-                               }
+                           scmi_protocol_is_supported(dev,
+ protocol_id))
                                 drv =

DM_DRIVER_GET(scmi_voltage_domain);

drivers/firmware/scmi/scmi_agent-uclass.c +0 -1
-                       }
                         break;
                 default:
                         break;
drivers/power/regulator/scmi_regulator.c +6 -0
index 99f6506f162..2550b27246f 100644
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
         ofnode node;
         int ret;
 
+       node = ofnode_find_subnode(node, "regulators");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "no regulators node\n");
+               return -ENXIO;
+       }
+
         drv = DM_DRIVER_GET(scmi_regulator);
 
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
drivers/power/regulator/scmi_regulator.c +0 -1
         ofnode_for_each_subnode(node, dev_ofnode(dev)) {
--

2.47.2

Hi Marek,

Is there a problem in your patch? Should it be changed like this:

What kind of problem ? Can you please elaborate ?

I think that in the scmi_regulator_bind() function, the second parameter passed into ofnode_for_each_subnode() should be the node named "regulators".

static int scmi_regulator_bind(struct udevice *dev)

{
	struct driver *drv;
	ofnode regul_node;
	ofnode node;
	int ret;

	regul_node = ofnode_find_subnode(dev_ofnode(dev), "regulators");
	if (!ofnode_valid(regul_node)) {
		dev_err(dev, "no regulators node\n");
		return -ENXIO;
	}

	drv = DM_DRIVER_GET(scmi_regulator);

	ofnode_for_each_subnode(node, regul_node) {
		ret = device_bind(dev, drv, ofnode_get_name(node),
				  NULL, node, NULL);
		if (ret)
			return ret;
	}

	return 0;
}

Best Regards,
Alice Guo

#4 lore raw
Quoted 105 lines · Alice Guo (OSS)
Quoted 94 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年4月9日 2:31
收件人: Alice Guo (OSS) <[email protected]>; [email protected] 抄送: Alice Guo <[email protected]>; Ilias Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]>
主题: Re: 回复: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Quoted 5 lines · Alice Guo (OSS)
Quoted 5 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年3月22日 9:45
收件人: [email protected]
抄送: Marek Vasut <[email protected]>; Alice Guo <[email protected]>;

Ilias

Quoted 10 lines
Quoted 10 lines

Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]> 主题: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 5 lines
Quoted 5 lines

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to

its subnodes.

Quoted 14 lines
Quoted 14 lines
Fixes 1f213ee4dbf2 ("firmware: scmi: voltage regulator")

---
Cc: Alice Guo <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
  drivers/firmware/scmi/scmi_agent-uclass.c | 8 +-------
drivers/power/regulator/scmi_regulator.c  | 6 ++++++
  2 files changed, 7 insertions(+), 7 deletions(-)
Quoted 9 lines

drivers/firmware/scmi/scmi_agent-uclass.c static int scmi_bind_protocols(struct udevice *dev) · line 429

Quoted 9 lines
drivers/firmware/scmi/scmi_agent-uclass.c +0 -0
index 8c907c3b032..e6e43ae936a 100644
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
                         break;
                 case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
                         if

(IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)

Quoted 2 lines
Quoted 2 lines

&&
- scmi_protocol_is_supported(dev,

protocol_id))

Quoted 5 lines

drivers/firmware/scmi/scmi_agent-uclass.c

Quoted 5 lines

{
- node = ofnode_find_subnode(node,
"regulators");

drivers/firmware/scmi/scmi_agent-uclass.c +0 -2
-                               if (!ofnode_valid(node)) {
-                                       dev_err(dev, "no

regulators

Quoted 28 lines
Quoted 28 lines

node\n");

drivers/firmware/scmi/scmi_agent-uclass.c +2 -2
-                                       return -ENXIO;
-                               }
+                           scmi_protocol_is_supported(dev,
+ protocol_id))
                                 drv =

DM_DRIVER_GET(scmi_voltage_domain);

drivers/firmware/scmi/scmi_agent-uclass.c +0 -1
-                       }
                         break;
                 default:
                         break;
drivers/power/regulator/scmi_regulator.c +6 -0
index 99f6506f162..2550b27246f 100644
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
         ofnode node;
         int ret;
 
+       node = ofnode_find_subnode(node, "regulators");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "no regulators node\n");
+               return -ENXIO;
+       }
+
         drv = DM_DRIVER_GET(scmi_regulator);
 
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
drivers/power/regulator/scmi_regulator.c +0 -1
         ofnode_for_each_subnode(node, dev_ofnode(dev)) {
--

2.47.2

Hi Marek,

Is there a problem in your patch? Should it be changed like this:

What kind of problem ? Can you please elaborate ?

I think that in the scmi_regulator_bind() function, the second parameter passed into ofnode_for_each_subnode() should be the node named "regulators".

Quoted 8 lines

static int scmi_regulator_bind(struct udevice *dev)

{
	struct driver *drv;
	ofnode regul_node;
	ofnode node;
	int ret;

	regul_node = ofnode_find_subnode(dev_ofnode(dev), "regulators");

Right. I could correct this when apply the patch.

Thanks,
Peng

Quoted 20 lines
	if (!ofnode_valid(regul_node)) {
		dev_err(dev, "no regulators node\n");
		return -ENXIO;
	}

	drv = DM_DRIVER_GET(scmi_regulator);

	ofnode_for_each_subnode(node, regul_node) {
		ret = device_bind(dev, drv, ofnode_get_name(node),
				  NULL, node, NULL);
		if (ret)
			return ret;
	}

	return 0;
}

Best Regards,
Alice Guo

#5 lore raw
Quoted 113 lines · Peng Fan
Quoted 112 lines · Alice Guo (OSS)
Quoted 94 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年4月9日 2:31
收件人: Alice Guo (OSS) <[email protected]>; [email protected] 抄送: Alice Guo <[email protected]>; Ilias Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]>
主题: Re: 回复: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Quoted 5 lines · Alice Guo (OSS)
Quoted 5 lines

-----邮件原件-----
发件人: Marek Vasut <[email protected]>
发送时间: 2025年3月22日 9:45
收件人: [email protected]
抄送: Marek Vasut <[email protected]>; Alice Guo <[email protected]>;

Ilias

Quoted 10 lines
Quoted 10 lines

Apalodimas <[email protected]>; Jaehoon Chung <[email protected]>; Tom Rini <[email protected]> 主题: [EXT] [PATCH] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

Caution: This is an external email. Please take care when clicking links or opening attachments. When in doubt, report the message using the 'Report this email' button

Quoted 5 lines
Quoted 5 lines

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to

its subnodes.

Quoted 14 lines
Quoted 14 lines
Fixes 1f213ee4dbf2 ("firmware: scmi: voltage regulator")

---
Cc: Alice Guo <[email protected]>
Cc: Ilias Apalodimas <[email protected]>
Cc: Jaehoon Chung <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: [email protected]

---
  drivers/firmware/scmi/scmi_agent-uclass.c | 8 +-------
drivers/power/regulator/scmi_regulator.c  | 6 ++++++
  2 files changed, 7 insertions(+), 7 deletions(-)
Quoted 9 lines

drivers/firmware/scmi/scmi_agent-uclass.c static int scmi_bind_protocols(struct udevice *dev) · line 429

Quoted 9 lines
drivers/firmware/scmi/scmi_agent-uclass.c +0 -0
index 8c907c3b032..e6e43ae936a 100644
@@ -427,14 +427,8 @@ static int scmi_bind_protocols(struct udevice *dev)
                         break;
                 case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
                         if

(IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)

Quoted 2 lines
Quoted 2 lines

&&
- scmi_protocol_is_supported(dev,

protocol_id))

Quoted 5 lines

drivers/firmware/scmi/scmi_agent-uclass.c

Quoted 5 lines

{
- node = ofnode_find_subnode(node,
"regulators");

drivers/firmware/scmi/scmi_agent-uclass.c +0 -2
-                               if (!ofnode_valid(node)) {
-                                       dev_err(dev, "no

regulators

Quoted 28 lines
Quoted 28 lines

node\n");

drivers/firmware/scmi/scmi_agent-uclass.c +2 -2
-                                       return -ENXIO;
-                               }
+                           scmi_protocol_is_supported(dev,
+ protocol_id))
                                 drv =

DM_DRIVER_GET(scmi_voltage_domain);

drivers/firmware/scmi/scmi_agent-uclass.c +0 -1
-                       }
                         break;
                 default:
                         break;
drivers/power/regulator/scmi_regulator.c +6 -0
index 99f6506f162..2550b27246f 100644
@@ -178,6 +178,12 @@ static int scmi_regulator_bind(struct udevice *dev)
         ofnode node;
         int ret;
 
+       node = ofnode_find_subnode(node, "regulators");
+       if (!ofnode_valid(node)) {
+               dev_err(dev, "no regulators node\n");
+               return -ENXIO;
+       }
+
         drv = DM_DRIVER_GET(scmi_regulator);
 
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
drivers/power/regulator/scmi_regulator.c +0 -1
         ofnode_for_each_subnode(node, dev_ofnode(dev)) {
--

2.47.2

Hi Marek,

Is there a problem in your patch? Should it be changed like this:

What kind of problem ? Can you please elaborate ?

I think that in the scmi_regulator_bind() function, the second parameter passed into ofnode_for_each_subnode() should be the node named "regulators".

static int scmi_regulator_bind(struct udevice *dev)

{
	struct driver *drv;
	ofnode regul_node;
	ofnode node;
	int ret;
Quoted 10 lines
Quoted 1 line
	regul_node = ofnode_find_subnode(dev_ofnode(dev), "regulators");

Right. I could correct this when apply the patch.

Thanks,
Peng

Quoted 2 lines
	if (!ofnode_valid(regul_node)) {
		dev_err(dev, "no regulators node\n");

This patch has issue, it will always return failure here.

Regards,
Peng

Quoted 18 lines
Quoted 18 lines
		return -ENXIO;
	}

	drv = DM_DRIVER_GET(scmi_regulator);

	ofnode_for_each_subnode(node, regul_node) {
		ret = device_bind(dev, drv, ofnode_get_name(node),
				  NULL, node, NULL);
		if (ret)
			return ret;
	}

	return 0;
}

Best Regards,
Alice Guo

#6 lore raw
In reply to Marek Vasut

From: Peng Fan <[email protected]>

Quoted 8 lines · Marek Vasut

The current code attempts to bind scmi_voltage_domain to regulator subnode of the SCMI protocol node, so scmi_voltage_domain can then bind regulators directly to subnodes of its node. This kind of behavior should not be in core code, move it into scmi_voltage_domain driver code. Let the driver descend into regulator node and bind regulators to its subnodes.

[...]

After apply a fix from Alice Guo, applied, thanks!

[1/1] power: regulator: scmi: Move regulator subnode hack to scmi_regulator

      commit: 2a8e7ea4f948e3de7033b297fd827fe082cd63da

Best regards,

Signature · 1 line
Peng Fan <[email protected]>