diff mbox series

[XEN,RFC,06/13] device tree: Add dt_print_node_names()

Message ID 1630562763-390068-7-git-send-email-fnu.vikram@xilinx.com (mailing list archive)
State New, archived
Headers show
Series Add Support for dynamic Programming | expand

Commit Message

Vikram Garhwal Sept. 2, 2021, 6:05 a.m. UTC
Add dt_print_node_names() to print all nodes under a dt_device_node.
dt_print_node_names() takes a dt_device_node type input and prints the node name
of all the subsequent nodes. This is added for debugging purpose for device tree
overlays.

Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
---
 xen/common/device_tree.c      | 10 ++++++++++
 xen/include/xen/device_tree.h |  5 +++++
 2 files changed, 15 insertions(+)

Comments

Julien Grall Oct. 21, 2021, 9:04 a.m. UTC | #1
Hi Vikram,

On 02/09/2021 07:05, Vikram Garhwal wrote:
> Add dt_print_node_names() to print all nodes under a dt_device_node.
> dt_print_node_names() takes a dt_device_node type input and prints the node name
> of all the subsequent nodes. This is added for debugging purpose for device tree
> overlays.

I can't find any use of this function in the rest of series. While I 
understand it was helpful for you, I am not entirely convinced that we 
should add it in Xen with no-use. The code is simple enough for anyone 
to re-implement it if needed.

Cheers,

> 
> Signed-off-by: Vikram Garhwal <fnu.vikram@xilinx.com>
> ---
>   xen/common/device_tree.c      | 10 ++++++++++
>   xen/include/xen/device_tree.h |  5 +++++
>   2 files changed, 15 insertions(+)
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index cda21be..bfe3191 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -308,6 +308,16 @@ struct dt_device_node *dt_find_node_by_path(const char *path)
>       return np;
>   }
>   
> +void dt_print_node_names(struct dt_device_node *dt)
> +{
> +    struct dt_device_node *np;
> +
> +    dt_for_each_device_node(dt, np)
> +        dt_dprintk("Node name: %s Full name %s\n", np->name, np->full_name);
> +
> +    return;
> +}
> +
>   int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen,
>                             struct dt_device_node **node)
>   {
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index a4e98a7..dcd96b4 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -483,6 +483,11 @@ struct dt_device_node *dt_find_node_by_path(const char *path);
>   int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen,
>                             struct dt_device_node **node);
>   
> +/*
> + * Prints all node names.
> + */
> +void dt_print_node_names(struct dt_device_node *dt);
> +
>   /**
>    * dt_get_parent - Get a node's parent if any
>    * @node: Node to get parent
>
diff mbox series

Patch

diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index cda21be..bfe3191 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -308,6 +308,16 @@  struct dt_device_node *dt_find_node_by_path(const char *path)
     return np;
 }
 
+void dt_print_node_names(struct dt_device_node *dt)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(dt, np)
+        dt_dprintk("Node name: %s Full name %s\n", np->name, np->full_name);
+
+    return;
+}
+
 int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen,
                           struct dt_device_node **node)
 {
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index a4e98a7..dcd96b4 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -483,6 +483,11 @@  struct dt_device_node *dt_find_node_by_path(const char *path);
 int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen,
                           struct dt_device_node **node);
 
+/*
+ * Prints all node names.
+ */
+void dt_print_node_names(struct dt_device_node *dt);
+
 /**
  * dt_get_parent - Get a node's parent if any
  * @node: Node to get parent