]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/riscv: virt: Switch to use qemu_fdt_setprop_string_array() helper
authorBin Meng <bin.meng@windriver.com>
Fri, 30 Apr 2021 07:12:56 +0000 (15:12 +0800)
committerAlistair Francis <alistair.francis@wdc.com>
Mon, 7 Jun 2021 23:59:42 +0000 (09:59 +1000)
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>
Message-id: 20210430071302.1489082-2-bmeng.cn@gmail.com
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
hw/riscv/virt.c

index 95a11adaa2f229fd0c3df34c1a9e82711f38ff96..1e017d1c5284fa77cd5f90de81411908451566f7 100644 (file)
@@ -394,8 +394,11 @@ 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));
+        static const char * const 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,