Re: [U-Boot] [PATCH v2 2/4] dm: core: Move "/clock" node scan into function

2018-09-28 Thread Simon Glass
On 19 September 2018 at 03:43, Rajan Vaja  wrote:
> Create separate function for scanning node by path and
> move "/clock" node scan code into that function.
>
> This will be usable if scanning of more node is required.
>
> Signed-off-by: Rajan Vaja 
> Reviewed-by: Simon Glass 
> ---
> Changes in v2:
>   * None
> ---
>  drivers/core/root.c | 33 ++---
>  1 file changed, 18 insertions(+), 15 deletions(-)

Applied to u-boot-dm, and now in mainline, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 2/4] dm: core: Move "/clock" node scan into function

2018-09-19 Thread Rajan Vaja
Create separate function for scanning node by path and
move "/clock" node scan code into that function.

This will be usable if scanning of more node is required.

Signed-off-by: Rajan Vaja 
Reviewed-by: Simon Glass 
---
Changes in v2:
  * None
---
 drivers/core/root.c | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 72bcc7d..1ab4c38 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -330,10 +330,25 @@ static int dm_scan_fdt_node(struct udevice *parent, const 
void *blob,
 }
 #endif
 
+static int dm_scan_fdt_ofnode_path(const char *path, bool pre_reloc_only)
+{
+   ofnode node;
+
+   node = ofnode_path(path);
+   if (!ofnode_valid(node))
+   return 0;
+
+#if CONFIG_IS_ENABLED(OF_LIVE)
+   if (of_live_active())
+   return dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
+#endif
+   return dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
+   pre_reloc_only);
+}
+
 int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
 {
int ret;
-   ofnode node;
 
ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
if (ret) {
@@ -341,21 +356,9 @@ int dm_extended_scan_fdt(const void *blob, bool 
pre_reloc_only)
return ret;
}
 
-   /* bind fixed-clock */
-   node = ofnode_path("/clocks");
-   /* if no DT "clocks" node, no need to go further */
-   if (!ofnode_valid(node))
-   return ret;
-
-#if CONFIG_IS_ENABLED(OF_LIVE)
-   if (of_live_active())
-   ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
-   else
-#endif
-   ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, 
node.of_offset,
-  pre_reloc_only);
+   ret = dm_scan_fdt_ofnode_path("/clocks", pre_reloc_only);
if (ret)
-   debug("dm_scan_fdt_node() failed: %d\n", ret);
+   debug("scan for /clocks failed: %d\n", ret);
 
return ret;
 }
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot