diff mbox series

[v2,03/12] firmware: scmi: move scmi_bind_protocols() backward

Message ID 20230726083808.140780-4-takahiro.akashi@linaro.org
State Superseded
Headers show
Series firmware: scmi: add SCMI base protocol support | expand

Commit Message

AKASHI Takahiro July 26, 2023, 8:37 a.m. UTC
Move the location of scmi_bind_protocols() backward for changes
in later patches.
There is no change in functionality.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
---
 drivers/firmware/scmi/scmi_agent-uclass.c | 118 +++++++++++-----------
 1 file changed, 59 insertions(+), 59 deletions(-)

Comments

Simon Glass July 27, 2023, 12:50 a.m. UTC | #1
On Wed, 26 Jul 2023 at 02:38, AKASHI Takahiro
<takahiro.akashi@linaro.org> wrote:
>
> Move the location of scmi_bind_protocols() backward for changes
> in later patches.
> There is no change in functionality.
>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/firmware/scmi/scmi_agent-uclass.c | 118 +++++++++++-----------
>  1 file changed, 59 insertions(+), 59 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Etienne CARRIERE Aug. 3, 2023, 9:37 a.m. UTC | #2
> From: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Sent: Wednesday, July 26, 2023 10:37
>  
> Move the location of scmi_bind_protocols() backward for changes
> in later patches.
> There is no change in functionality.
> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> ---
>  drivers/firmware/scmi/scmi_agent-uclass.c | 118 +++++++++++-----------
>  1 file changed, 59 insertions(+), 59 deletions(-)
> 

Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>


> diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c
> index 39cf15c88f75..8693e4c447b7 100644
> --- a/drivers/firmware/scmi/scmi_agent-uclass.c
> +++ b/drivers/firmware/scmi/scmi_agent-uclass.c
> @@ -52,65 +52,6 @@ int scmi_to_linux_errno(s32 scmi_code)
>          return -EPROTO;
>  }
>  
> -/*
> - * SCMI agent devices binds devices of various uclasses depeding on
> - * the FDT description. scmi_bind_protocol() is a generic bind sequence
> - * called by the uclass at bind stage, that is uclass post_bind.
> - */
> -static int scmi_bind_protocols(struct udevice *dev)
> -{
> -       int ret = 0;
> -       ofnode node;
> -       const char *name;
> -
> -       dev_for_each_subnode(node, dev) {
> -               struct driver *drv = NULL;
> -               u32 protocol_id;
> -
> -               if (!ofnode_is_enabled(node))
> -                       continue;
> -
> -               if (ofnode_read_u32(node, "reg", &protocol_id))
> -                       continue;
> -
> -               name = ofnode_get_name(node);
> -               switch (protocol_id) {
> -               case SCMI_PROTOCOL_ID_CLOCK:
> -                       if (CONFIG_IS_ENABLED(CLK_SCMI))
> -                               drv = DM_DRIVER_GET(scmi_clock);
> -                       break;
> -               case SCMI_PROTOCOL_ID_RESET_DOMAIN:
> -                       if (IS_ENABLED(CONFIG_RESET_SCMI))
> -                               drv = DM_DRIVER_GET(scmi_reset_domain);
> -                       break;
> -               case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
> -                       if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {
> -                               node = ofnode_find_subnode(node, "regulators");
> -                               if (!ofnode_valid(node)) {
> -                                       dev_err(dev, "no regulators node\n");
> -                                       return -ENXIO;
> -                               }
> -                               drv = DM_DRIVER_GET(scmi_voltage_domain);
> -                       }
> -                       break;
> -               default:
> -                       break;
> -               }
> -
> -               if (!drv) {
> -                       dev_dbg(dev, "Ignore unsupported SCMI protocol %#x\n",
> -                               protocol_id);
> -                       continue;
> -               }
> -
> -               ret = device_bind(dev, drv, name, NULL, node, NULL);
> -               if (ret)
> -                       break;
> -       }
> -
> -       return ret;
> -}
> -
>  static struct udevice *find_scmi_transport_device(struct udevice *dev)
>  {
>          struct udevice *parent = dev;
> @@ -208,6 +149,65 @@ int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg)
>          return scmi_process_msg(parent, priv->channel, msg);
>  }
>  
> +/*
> + * SCMI agent devices binds devices of various uclasses depeding on
> + * the FDT description. scmi_bind_protocol() is a generic bind sequence
> + * called by the uclass at bind stage, that is uclass post_bind.
> + */
> +static int scmi_bind_protocols(struct udevice *dev)
> +{
> +       int ret = 0;
> +       ofnode node;
> +       const char *name;
> +
> +       dev_for_each_subnode(node, dev) {
> +               struct driver *drv = NULL;
> +               u32 protocol_id;
> +
> +               if (!ofnode_is_enabled(node))
> +                       continue;
> +
> +               if (ofnode_read_u32(node, "reg", &protocol_id))
> +                       continue;
> +
> +               name = ofnode_get_name(node);
> +               switch (protocol_id) {
> +               case SCMI_PROTOCOL_ID_CLOCK:
> +                       if (CONFIG_IS_ENABLED(CLK_SCMI))
> +                               drv = DM_DRIVER_GET(scmi_clock);
> +                       break;
> +               case SCMI_PROTOCOL_ID_RESET_DOMAIN:
> +                       if (IS_ENABLED(CONFIG_RESET_SCMI))
> +                               drv = DM_DRIVER_GET(scmi_reset_domain);
> +                       break;
> +               case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
> +                       if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {
> +                               node = ofnode_find_subnode(node, "regulators");
> +                               if (!ofnode_valid(node)) {
> +                                       dev_err(dev, "no regulators node\n");
> +                                       return -ENXIO;
> +                               }
> +                               drv = DM_DRIVER_GET(scmi_voltage_domain);
> +                       }
> +                       break;
> +               default:
> +                       break;
> +               }
> +
> +               if (!drv) {
> +                       dev_dbg(dev, "Ignore unsupported SCMI protocol %#x\n",
> +                               protocol_id);
> +                       continue;
> +               }
> +
> +               ret = device_bind(dev, drv, name, NULL, node, NULL);
> +               if (ret)
> +                       break;
> +       }
> +
> +       return ret;
> +}
> +
>  UCLASS_DRIVER(scmi_agent) = {
>          .id             = UCLASS_SCMI_AGENT,
>          .name           = "scmi_agent",
> -- 
> 2.41.0
>
diff mbox series

Patch

diff --git a/drivers/firmware/scmi/scmi_agent-uclass.c b/drivers/firmware/scmi/scmi_agent-uclass.c
index 39cf15c88f75..8693e4c447b7 100644
--- a/drivers/firmware/scmi/scmi_agent-uclass.c
+++ b/drivers/firmware/scmi/scmi_agent-uclass.c
@@ -52,65 +52,6 @@  int scmi_to_linux_errno(s32 scmi_code)
 	return -EPROTO;
 }
 
-/*
- * SCMI agent devices binds devices of various uclasses depeding on
- * the FDT description. scmi_bind_protocol() is a generic bind sequence
- * called by the uclass at bind stage, that is uclass post_bind.
- */
-static int scmi_bind_protocols(struct udevice *dev)
-{
-	int ret = 0;
-	ofnode node;
-	const char *name;
-
-	dev_for_each_subnode(node, dev) {
-		struct driver *drv = NULL;
-		u32 protocol_id;
-
-		if (!ofnode_is_enabled(node))
-			continue;
-
-		if (ofnode_read_u32(node, "reg", &protocol_id))
-			continue;
-
-		name = ofnode_get_name(node);
-		switch (protocol_id) {
-		case SCMI_PROTOCOL_ID_CLOCK:
-			if (CONFIG_IS_ENABLED(CLK_SCMI))
-				drv = DM_DRIVER_GET(scmi_clock);
-			break;
-		case SCMI_PROTOCOL_ID_RESET_DOMAIN:
-			if (IS_ENABLED(CONFIG_RESET_SCMI))
-				drv = DM_DRIVER_GET(scmi_reset_domain);
-			break;
-		case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
-			if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {
-				node = ofnode_find_subnode(node, "regulators");
-				if (!ofnode_valid(node)) {
-					dev_err(dev, "no regulators node\n");
-					return -ENXIO;
-				}
-				drv = DM_DRIVER_GET(scmi_voltage_domain);
-			}
-			break;
-		default:
-			break;
-		}
-
-		if (!drv) {
-			dev_dbg(dev, "Ignore unsupported SCMI protocol %#x\n",
-				protocol_id);
-			continue;
-		}
-
-		ret = device_bind(dev, drv, name, NULL, node, NULL);
-		if (ret)
-			break;
-	}
-
-	return ret;
-}
-
 static struct udevice *find_scmi_transport_device(struct udevice *dev)
 {
 	struct udevice *parent = dev;
@@ -208,6 +149,65 @@  int devm_scmi_process_msg(struct udevice *dev, struct scmi_msg *msg)
 	return scmi_process_msg(parent, priv->channel, msg);
 }
 
+/*
+ * SCMI agent devices binds devices of various uclasses depeding on
+ * the FDT description. scmi_bind_protocol() is a generic bind sequence
+ * called by the uclass at bind stage, that is uclass post_bind.
+ */
+static int scmi_bind_protocols(struct udevice *dev)
+{
+	int ret = 0;
+	ofnode node;
+	const char *name;
+
+	dev_for_each_subnode(node, dev) {
+		struct driver *drv = NULL;
+		u32 protocol_id;
+
+		if (!ofnode_is_enabled(node))
+			continue;
+
+		if (ofnode_read_u32(node, "reg", &protocol_id))
+			continue;
+
+		name = ofnode_get_name(node);
+		switch (protocol_id) {
+		case SCMI_PROTOCOL_ID_CLOCK:
+			if (CONFIG_IS_ENABLED(CLK_SCMI))
+				drv = DM_DRIVER_GET(scmi_clock);
+			break;
+		case SCMI_PROTOCOL_ID_RESET_DOMAIN:
+			if (IS_ENABLED(CONFIG_RESET_SCMI))
+				drv = DM_DRIVER_GET(scmi_reset_domain);
+			break;
+		case SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN:
+			if (IS_ENABLED(CONFIG_DM_REGULATOR_SCMI)) {
+				node = ofnode_find_subnode(node, "regulators");
+				if (!ofnode_valid(node)) {
+					dev_err(dev, "no regulators node\n");
+					return -ENXIO;
+				}
+				drv = DM_DRIVER_GET(scmi_voltage_domain);
+			}
+			break;
+		default:
+			break;
+		}
+
+		if (!drv) {
+			dev_dbg(dev, "Ignore unsupported SCMI protocol %#x\n",
+				protocol_id);
+			continue;
+		}
+
+		ret = device_bind(dev, drv, name, NULL, node, NULL);
+		if (ret)
+			break;
+	}
+
+	return ret;
+}
+
 UCLASS_DRIVER(scmi_agent) = {
 	.id		= UCLASS_SCMI_AGENT,
 	.name		= "scmi_agent",