Message ID | 20210329170818.23139-2-bmeng.cn@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/8] hw/riscv: sifive_u: Switch to use qemu_fdt_setprop_string_array() helper | expand |
On Mon, Mar 29, 2021 at 1:17 PM Bin Meng <bmeng.cn@gmail.com> wrote: > > From: Bin Meng <bin.meng@windriver.com> > > Since commit 78da6a1bca22 ("device_tree: add qemu_fdt_setprop_string_array helper"), > we can use the new helper to set the compatible strings for the > SiFive test device node. > > Signed-off-by: Bin Meng <bin.meng@windriver.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Alistair > --- > > hw/riscv/virt.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c > index c0dc69ff33..5d0c1e5903 100644 > --- a/hw/riscv/virt.c > +++ b/hw/riscv/virt.c > @@ -395,8 +395,9 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap, > (long)memmap[VIRT_TEST].base); > qemu_fdt_add_subnode(fdt, name); > { > - const char compat[] = "sifive,test1\0sifive,test0\0syscon"; > - qemu_fdt_setprop(fdt, name, "compatible", compat, sizeof(compat)); > + const char *compat[3] = { "sifive,test1", "sifive,test0", "syscon" }; > + qemu_fdt_setprop_string_array(fdt, name, "compatible", (char **)&compat, > + ARRAY_SIZE(compat)); > } > qemu_fdt_setprop_cells(fdt, name, "reg", > 0x0, memmap[VIRT_TEST].base, > -- > 2.25.1 > >
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c index c0dc69ff33..5d0c1e5903 100644 --- a/hw/riscv/virt.c +++ b/hw/riscv/virt.c @@ -395,8 +395,9 @@ static void create_fdt(RISCVVirtState *s, const MemMapEntry *memmap, (long)memmap[VIRT_TEST].base); qemu_fdt_add_subnode(fdt, name); { - const char compat[] = "sifive,test1\0sifive,test0\0syscon"; - qemu_fdt_setprop(fdt, name, "compatible", compat, sizeof(compat)); + const char *compat[3] = { "sifive,test1", "sifive,test0", "syscon" }; + qemu_fdt_setprop_string_array(fdt, name, "compatible", (char **)&compat, + ARRAY_SIZE(compat)); } qemu_fdt_setprop_cells(fdt, name, "reg", 0x0, memmap[VIRT_TEST].base,