[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN][RFC PATCH v4 05/16] xen/device-tree: Add _dt_find_node_by_path() to find nodes in device tree


  • To: Vikram Garhwal <vikram.garhwal@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Fri, 20 Jan 2023 13:50:38 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kRIjhlI7J3YlTvH//k+3wzT8sYdd/bnubg/ndIDpPq0=; b=lTNSq2pqBBTUwudrYO6lHxV0kSBDOb+NtpXXVMi/QNvH1eKBNBrCPVGCl0FO6Wrg+zvfIVTnoAIgkhP1GybDbzs3e7jfQPz6FjyzjsJmUFHVNDKtU+5yc3yIVZ5pM744STwWyHsbJ/Cy2XqSxNoOgOtrorANNfClS8hvwnLfpsMokMF0UlPF/5fXSVDEuaoln7QZI76pqN37xz7jdyVdBW3Z0YaFgUKFrjBvvCG/i+aUO8dpVfWdPHoxcx2kzJoquCpqb9GARDAYOLGwl0xEmzk78lRB+naXMkRqT9D60iDwMITuPZq0pMo934rWjNcT7AmsVhkJxxxDpv8DzVdW7Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mt4akUxZaIeSPVsP/Tk4pYCOsdO8jtWTlIhF9eMCS3clJXDIS4nvfK5SZaVkT5bKbrZvoF46KP9yPQWb9L03Xq54erM7K/vP/xDZ4gE5Ab+x7I5OZeAxqOYCkoPwqyCuMczMZA4rGH7lNzQxvTLGhfhIpNHC300M0L8GBobCtasmbuO7gvclzLgmTww3H9/HmQMPjTyDCrHCOkDZaRAYrQh5G/mQWRhhN/Xf9SMQVDXGRbH2JA8n752PPXMe1gA7iQuPnFPBAsbmVG4UD2W6Y6tHIou1FWqqlD3bIkEzEW/+CeR/eI7D/045KjU/5wpOdafiB3qAFRVdr3EFDmRYlQ==
  • Cc: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>
  • Delivery-date: Fri, 20 Jan 2023 12:51:15 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Vikram,

On 07/12/2022 07:15, Vikram Garhwal wrote:
> 
> 
> Add _dt_find_by_path() to find a matching node with path for a dt_device_node.
Here and in commit title you say _dt_find_by_path but you introduce 
device_tree_find_node_by_path.
Also, it would be beneficial to state why such change is needed.

> 
> Signed-off-by: Vikram Garhwal <vikram.garhwal@xxxxxxx>
> ---
>  xen/common/device_tree.c      |  5 +++--
>  xen/include/xen/device_tree.h | 16 ++++++++++++++--
>  2 files changed, 17 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
> index 6518eff9b0..acf26a411d 100644
> --- a/xen/common/device_tree.c
> +++ b/xen/common/device_tree.c
> @@ -358,11 +358,12 @@ 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 *device_tree_find_node_by_path(struct dt_device_node 
> *dt,
> +                                                     const char *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;
> 
> diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
> index bde46d7120..51e251b0b4 100644
> --- a/xen/include/xen/device_tree.h
> +++ b/xen/include/xen/device_tree.h
> @@ -537,13 +537,25 @@ struct dt_device_node *dt_find_node_by_type(struct 
> dt_device_node *from,
>  struct dt_device_node *dt_find_node_by_alias(const char *alias);
> 
>  /**
> - * dt_find_node_by_path - Find a node matching a full DT path
> + * device_tree_find_node_by_path - Find a node matching a full DT path
This description and ...
> + * @dt_node: The device tree to search
>   * @path: The full path to match
>   *
>   * Returns a node pointer.
>   */
> -struct dt_device_node *dt_find_node_by_path(const char *path);
> +struct dt_device_node *device_tree_find_node_by_path(struct dt_device_node 
> *dt,
> +                                                     const char *path);
> 
> +/**
> + * dt_find_node_by_path - Find a node matching a full DT path
... this are identical. I think you should describe the difference.
The function names are also very similar and can be confused but I won't oppose 
it.
I will leave the decision to maintainers.


> + * @path: The full path to match
> + *
> + * Returns a node pointer.
> + */
> +static inline struct dt_device_node *dt_find_node_by_path(const char *path)
> +{
> +    return device_tree_find_node_by_path(dt_host, path);
> +}
> 
>  /**
>   * dt_find_node_by_gpath - Same as dt_find_node_by_path but retrieve the
> --
> 2.17.1
> 
> 
~Michal




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.