Hi Vikram,
> On 8 Mar 2022, at 19:46, Vikram Garhwal <[email protected]> wrote:
>
> Add _dt_find_by_path() to find a matching node with path for a dt_device_node.
>
> Signed-off-by: Vikram Garhwal <[email protected]>
> ---
> xen/common/device_tree.c | 10 ++++++++--
> xen/include/xen/device_tree.h | 9 +++++++++
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index f43d66a501..2e334f949e 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -358,17 +358,23 @@ struct dt_device_node *dt_find_node_by_type(struct
> dt_device_node *from,
> return np;
> }
>
> -struct dt_device_node *dt_find_node_by_path(const char *path)
> +struct dt_device_node *_dt_find_node_by_path(struct dt_device_node *dt,
> + const char *path)
A function with a name starting with an underscore feels to me more an internal
function rather than public,
I suggest to find another name, maybe device_tree_find_node_by_path?
> {
> struct dt_device_node *np;
>
> - dt_for_each_device_node(dt_host, np)
> + dt_for_each_device_node(dt, np)
> if ( np->full_name && (dt_node_cmp(np->full_name, path) == 0) )
> break;
>
> return np;
> }
>
> +struct dt_device_node *dt_find_node_by_path(const char *path)
> +{
> + return _dt_find_node_by_path(dt_host, path);
> +}
This is public but it’s not declared in device_tree.h. Maybe this can become a
static inline defined in the header?
Cheers,
Luca