]> git.proxmox.com Git - mirror_qemu.git/commitdiff
device_tree: Allow name wildcards in qemu_fdt_node_path()
authorEdgar E. Iglesias <edgar.iglesias@xilinx.com>
Thu, 23 Apr 2020 12:11:11 +0000 (14:11 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 30 Apr 2020 14:35:41 +0000 (15:35 +0100)
Allow name wildcards in qemu_fdt_node_path(). This is useful
to find all nodes with a given compatibility string.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Message-id: 20200423121114.4274-2-edgar.iglesias@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
device_tree.c
include/sysemu/device_tree.h

index bba6cc216419e7e87bbb399fd914f425634a663f..f5b4699aedb4b5a91970c49f5ed6484c68a8f0be 100644 (file)
@@ -308,7 +308,7 @@ char **qemu_fdt_node_path(void *fdt, const char *name, char *compat,
             offset = len;
             break;
         }
-        if (!strcmp(iter_name, name)) {
+        if (!name || !strcmp(iter_name, name)) {
             char *path;
 
             path = g_malloc(path_len);
index c16fd69bc0b136a876a8c7ae2edbfc755a048cf2..7c53ef763452a9b87bc98b7532da866c946ce7e2 100644 (file)
@@ -39,6 +39,9 @@ void *load_device_tree_from_sysfs(void);
  * NULL. If there is no error but no matching node was found, the
  * returned array contains a single element equal to NULL. If an error
  * was encountered when parsing the blob, the function returns NULL
+ *
+ * @name may be NULL to wildcard names and only match compatibility
+ * strings.
  */
 char **qemu_fdt_node_path(void *fdt, const char *name, char *compat,
                           Error **errp);