Message ID | 20200419162727.19148-2-edgar.iglesias@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | hw/arm: xlnx-zcu102: Disable unsupported FDT firmware nodes | expand |
On Sun, Apr 19, 2020 at 9:27 AM Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote: > > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> > > Allow name wildcards in qemu_fdt_node_path(). This is useful > to find all nodes with a given compatibility string. > > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > device_tree.c | 2 +- > include/sysemu/device_tree.h | 3 +++ > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/device_tree.c b/device_tree.c > index bba6cc2164..f5b4699aed 100644 > --- a/device_tree.c > +++ b/device_tree.c > @@ -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); > diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h > index c16fd69bc0..7c53ef7634 100644 > --- a/include/sysemu/device_tree.h > +++ b/include/sysemu/device_tree.h > @@ -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); > -- > 2.20.1 > >
diff --git a/device_tree.c b/device_tree.c index bba6cc2164..f5b4699aed 100644 --- a/device_tree.c +++ b/device_tree.c @@ -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); diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h index c16fd69bc0..7c53ef7634 100644 --- a/include/sysemu/device_tree.h +++ b/include/sysemu/device_tree.h @@ -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);