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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Vikram Garhwal <vikram.garhwal@xxxxxxx>
  • Date: Tue, 6 Dec 2022 22:15:26 -0800
  • 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=XLhSLOJ5pm1JyR9SwI48LW3Gv+ml3wGq6nn4glAMwVw=; b=mZdyUSw+gduU+S4Bmklwp/3OCIq7d1m3l+82Ct/ZJ7QQfyCdyq4uXPytuv5iXdTY4kYsygJVyM+/z8cNRnxsKW//bj/b1Onj9HKTZdGIkrEKO1lkD87El76izF2csDpHZelOE+lSw4vxxHmGx8JOqIljB4hJNjQN82ReTrX1TlieZjvkMWXnWZomciUFGmBVyrMY4t93Z5+O5Q1wfiEGghSpcF69u8RqbozTcP6qPdUayAGhXTsFuvxww4/Tn9WmRDHyEatx9UVmn0WBnIo/zxjLSb6k0hO2WgEkwZUA36tTGvkTweEm45PNnSgmsiwTrxmyY25X2QxmiHdxQmdGpw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jpy825VLUYfE4H2lD6b/aQbb32tWiSlUvcJakqRcQOAqQ3Q3AAibepNS38zp9iob2pkpjaDohtZi0EVKcQ5wg5QO69RYpQEpY9TwxXbZH15WR8kz8Q8tF0uNb/FQrfAD4Np8tTmG9L/ki+1RaaQ5LCaZJvYdmOVlURrjyeDUzrxh5bmsdsdjZfyfhsUhWZ7yaCYOwOscqHbX7YS9q4nFBCXUhC4gyy2eDfkd/MjZuviofeqcY+bZaC74Ic+0P9iiJYzQr9c9cVg+H0C9fIQTOa2x+jcJToFoiJTewsms/p+U9cgSNRzE/OBjAOjrng1Wqk8LcGVlRNLU2fCgUW0fmA==
  • Cc: <sstabellini@xxxxxxxxxx>, <julien@xxxxxxx>, <vikram.garhwal@xxxxxxx>
  • Delivery-date: Wed, 07 Dec 2022 06:22:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Add _dt_find_by_path() to find a matching node with path for a dt_device_node.

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
+ * @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
+ * @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




 


Rackspace

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