machine: Eliminate unnecessary stringify() usage

stringify() is useful when we need to use macros in compat_props
(like when we set virtio-baloon-pci.class=PCI_CLASS_MEMORY_RAM at
pc_i440fx_1_0_machine_options()), but it is pointless when we are
already providing a number literal.

Replace stringify() with string literals when appropriate.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190107193020.21744-3-ehabkost@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2019-01-07 17:30:19 -02:00
parent b3bcb3cedf
commit e0985450e1
4 changed files with 67 additions and 67 deletions

View File

@ -135,11 +135,11 @@ GlobalProperty hw_compat_2_8[] = {
{ {
.driver = "fw_cfg_mem", .driver = "fw_cfg_mem",
.property = "x-file-slots", .property = "x-file-slots",
.value = stringify(0x10), .value = "0x10",
},{ },{
.driver = "fw_cfg_io", .driver = "fw_cfg_io",
.property = "x-file-slots", .property = "x-file-slots",
.value = stringify(0x10), .value = "0x10",
},{ },{
.driver = "pflash_cfi01", .driver = "pflash_cfi01",
.property = "old-multiple-chip-handling", .property = "old-multiple-chip-handling",
@ -337,11 +337,11 @@ GlobalProperty hw_compat_2_1[] = {
},{ },{
.driver = "usb-mouse", .driver = "usb-mouse",
.property = "usb_version", .property = "usb_version",
.value = stringify(1), .value = "1",
},{ },{
.driver = "usb-kbd", .driver = "usb-kbd",
.property = "usb_version", .property = "usb_version",
.value = stringify(1), .value = "1",
},{ },{
.driver = "virtio-pci", .driver = "virtio-pci",
.property = "virtio-pci-bus-master-bug-migration", .property = "virtio-pci-bus-master-bug-migration",

View File

@ -148,11 +148,11 @@ GlobalProperty pc_compat_2_12[] = {
},{ },{
.driver = "EPYC-" TYPE_X86_CPU, .driver = "EPYC-" TYPE_X86_CPU,
.property = "xlevel", .property = "xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "EPYC-IBPB-" TYPE_X86_CPU, .driver = "EPYC-IBPB-" TYPE_X86_CPU,
.property = "xlevel", .property = "xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
}, },
}; };
const size_t pc_compat_2_12_len = G_N_ELEMENTS(pc_compat_2_12); const size_t pc_compat_2_12_len = G_N_ELEMENTS(pc_compat_2_12);
@ -191,7 +191,7 @@ GlobalProperty pc_compat_2_9[] = {
{ {
.driver = "mch", .driver = "mch",
.property = "extended-tseg-mbytes", .property = "extended-tseg-mbytes",
.value = stringify(0), .value = "0",
}, },
}; };
const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9); const size_t pc_compat_2_9_len = G_N_ELEMENTS(pc_compat_2_9);
@ -365,75 +365,75 @@ GlobalProperty pc_compat_2_3[] = {
},{ },{
.driver = "qemu64" "-" TYPE_X86_CPU, .driver = "qemu64" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(4), .value = "4",
},{ },{
.driver = "kvm64" "-" TYPE_X86_CPU, .driver = "kvm64" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(5), .value = "5",
},{ },{
.driver = "pentium3" "-" TYPE_X86_CPU, .driver = "pentium3" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(2), .value = "2",
},{ },{
.driver = "n270" "-" TYPE_X86_CPU, .driver = "n270" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(5), .value = "5",
},{ },{
.driver = "Conroe" "-" TYPE_X86_CPU, .driver = "Conroe" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(4), .value = "4",
},{ },{
.driver = "Penryn" "-" TYPE_X86_CPU, .driver = "Penryn" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(4), .value = "4",
},{ },{
.driver = "Nehalem" "-" TYPE_X86_CPU, .driver = "Nehalem" "-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(4), .value = "4",
},{ },{
.driver = "n270" "-" TYPE_X86_CPU, .driver = "n270" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Penryn" "-" TYPE_X86_CPU, .driver = "Penryn" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Conroe" "-" TYPE_X86_CPU, .driver = "Conroe" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Nehalem" "-" TYPE_X86_CPU, .driver = "Nehalem" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Westmere" "-" TYPE_X86_CPU, .driver = "Westmere" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "SandyBridge" "-" TYPE_X86_CPU, .driver = "SandyBridge" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "IvyBridge" "-" TYPE_X86_CPU, .driver = "IvyBridge" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Haswell" "-" TYPE_X86_CPU, .driver = "Haswell" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Haswell-noTSX" "-" TYPE_X86_CPU, .driver = "Haswell-noTSX" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Broadwell" "-" TYPE_X86_CPU, .driver = "Broadwell" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = "Broadwell-noTSX" "-" TYPE_X86_CPU, .driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,
.property = "min-xlevel", .property = "min-xlevel",
.value = stringify(0x8000000a), .value = "0x8000000a",
},{ },{
.driver = TYPE_X86_CPU, .driver = TYPE_X86_CPU,
.property = "kvm-no-smi-migration", .property = "kvm-no-smi-migration",
@ -566,7 +566,7 @@ GlobalProperty pc_compat_2_0[] = {
{ {
.driver = "apic", .driver = "apic",
.property = "version", .property = "version",
.value = stringify(0x11), .value = "0x11",
}, },
{ {
.driver = "nec-usb-xhci", .driver = "nec-usb-xhci",
@ -581,17 +581,17 @@ GlobalProperty pc_compat_2_0[] = {
{ {
.driver = "pci-serial", .driver = "pci-serial",
.property = "prog_if", .property = "prog_if",
.value = stringify(0), .value = "0",
}, },
{ {
.driver = "pci-serial-2x", .driver = "pci-serial-2x",
.property = "prog_if", .property = "prog_if",
.value = stringify(0), .value = "0",
}, },
{ {
.driver = "pci-serial-4x", .driver = "pci-serial-4x",
.property = "prog_if", .property = "prog_if",
.value = stringify(0), .value = "0",
}, },
{ {
.driver = "virtio-net-pci", .driver = "virtio-net-pci",
@ -629,7 +629,7 @@ GlobalProperty pc_compat_1_7[] = {
{ {
.driver = "hpet", .driver = "hpet",
.property = HPET_INTCAP, .property = HPET_INTCAP,
.value = stringify(4), .value = "4",
}, },
}; };
const size_t pc_compat_1_7_len = G_N_ELEMENTS(pc_compat_1_7); const size_t pc_compat_1_7_len = G_N_ELEMENTS(pc_compat_1_7);
@ -643,19 +643,19 @@ GlobalProperty pc_compat_1_6[] = {
},{ },{
.driver = "qemu64-" TYPE_X86_CPU, .driver = "qemu64-" TYPE_X86_CPU,
.property = "model", .property = "model",
.value = stringify(2), .value = "2",
},{ },{
.driver = "qemu32-" TYPE_X86_CPU, .driver = "qemu32-" TYPE_X86_CPU,
.property = "model", .property = "model",
.value = stringify(3), .value = "3",
},{ },{
.driver = "i440FX-pcihost", .driver = "i440FX-pcihost",
.property = "short_root_bus", .property = "short_root_bus",
.value = stringify(1), .value = "1",
},{ },{
.driver = "q35-pcihost", .driver = "q35-pcihost",
.property = "short_root_bus", .property = "short_root_bus",
.value = stringify(1), .value = "1",
}, },
}; };
const size_t pc_compat_1_6_len = G_N_ELEMENTS(pc_compat_1_6); const size_t pc_compat_1_6_len = G_N_ELEMENTS(pc_compat_1_6);
@ -665,27 +665,27 @@ GlobalProperty pc_compat_1_5[] = {
{ {
.driver = "Conroe-" TYPE_X86_CPU, .driver = "Conroe-" TYPE_X86_CPU,
.property = "model", .property = "model",
.value = stringify(2), .value = "2",
},{ },{
.driver = "Conroe-" TYPE_X86_CPU, .driver = "Conroe-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(2), .value = "2",
},{ },{
.driver = "Penryn-" TYPE_X86_CPU, .driver = "Penryn-" TYPE_X86_CPU,
.property = "model", .property = "model",
.value = stringify(2), .value = "2",
},{ },{
.driver = "Penryn-" TYPE_X86_CPU, .driver = "Penryn-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(2), .value = "2",
},{ },{
.driver = "Nehalem-" TYPE_X86_CPU, .driver = "Nehalem-" TYPE_X86_CPU,
.property = "model", .property = "model",
.value = stringify(2), .value = "2",
},{ },{
.driver = "Nehalem-" TYPE_X86_CPU, .driver = "Nehalem-" TYPE_X86_CPU,
.property = "min-level", .property = "min-level",
.value = stringify(2), .value = "2",
},{ },{
.driver = "virtio-net-pci", .driver = "virtio-net-pci",
.property = "any_layout", .property = "any_layout",
@ -697,11 +697,11 @@ GlobalProperty pc_compat_1_5[] = {
},{ },{
.driver = "i440FX-pcihost", .driver = "i440FX-pcihost",
.property = "short_root_bus", .property = "short_root_bus",
.value = stringify(0), .value = "0",
},{ },{
.driver = "q35-pcihost", .driver = "q35-pcihost",
.property = "short_root_bus", .property = "short_root_bus",
.value = stringify(0), .value = "0",
}, },
}; };
const size_t pc_compat_1_5_len = G_N_ELEMENTS(pc_compat_1_5); const size_t pc_compat_1_5_len = G_N_ELEMENTS(pc_compat_1_5);
@ -711,36 +711,36 @@ GlobalProperty pc_compat_1_4[] = {
{ {
.driver = "scsi-hd", .driver = "scsi-hd",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "scsi-cd", .driver = "scsi-cd",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "scsi-disk", .driver = "scsi-disk",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "ide-hd", .driver = "ide-hd",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "ide-cd", .driver = "ide-cd",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "ide-drive", .driver = "ide-drive",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "virtio-blk-pci", .driver = "virtio-blk-pci",
.property = "discard_granularity", .property = "discard_granularity",
.value = stringify(0), .value = "0",
},{ },{
.driver = "virtio-serial-pci", .driver = "virtio-serial-pci",
.property = "vectors", .property = "vectors",
/* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */ /* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */
.value = stringify(0xFFFFFFFF), .value = "0xFFFFFFFF",
},{ },{
.driver = "virtio-net-pci", .driver = "virtio-net-pci",
.property = "ctrl_guest_offloads", .property = "ctrl_guest_offloads",
@ -768,7 +768,7 @@ GlobalProperty pc_compat_1_4[] = {
},{ },{
.driver = "486-" TYPE_X86_CPU, .driver = "486-" TYPE_X86_CPU,
.property = "model", .property = "model",
.value = stringify(0), .value = "0",
}, },
{ {
.driver = "n270" "-" TYPE_X86_CPU, .driver = "n270" "-" TYPE_X86_CPU,

View File

@ -697,7 +697,7 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m)
{ {
.driver = "usb-tablet", .driver = "usb-tablet",
.property = "usb_version", .property = "usb_version",
.value = stringify(1), .value = "1",
},{ },{
.driver = "virtio-net-pci", .driver = "virtio-net-pci",
.property = "ctrl_mac_addr", .property = "ctrl_mac_addr",
@ -741,11 +741,11 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m)
},{ },{
.driver = "qxl", .driver = "qxl",
.property = "revision", .property = "revision",
.value = stringify(3), .value = "3",
},{ },{
.driver = "qxl-vga", .driver = "qxl-vga",
.property = "revision", .property = "revision",
.value = stringify(3), .value = "3",
},{ },{
.driver = "VGA", .driver = "VGA",
.property = "mmio", .property = "mmio",
@ -777,19 +777,19 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m)
},{ },{
.driver = "VGA", .driver = "VGA",
.property = "vgamem_mb", .property = "vgamem_mb",
.value = stringify(8), .value = "8",
},{ },{
.driver = "vmware-svga", .driver = "vmware-svga",
.property = "vgamem_mb", .property = "vgamem_mb",
.value = stringify(8), .value = "8",
},{ },{
.driver = "qxl-vga", .driver = "qxl-vga",
.property = "vgamem_mb", .property = "vgamem_mb",
.value = stringify(8), .value = "8",
},{ },{
.driver = "qxl", .driver = "qxl",
.property = "vgamem_mb", .property = "vgamem_mb",
.value = stringify(8), .value = "8",
},{ },{
.driver = "virtio-blk-pci", .driver = "virtio-blk-pci",
.property = "config-wce", .property = "config-wce",
@ -876,11 +876,11 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m)
},{ },{
.driver = "qxl", .driver = "qxl",
.property = "revision", .property = "revision",
.value = stringify(2), .value = "2",
},{ },{
.driver = "qxl-vga", .driver = "qxl-vga",
.property = "revision", .property = "revision",
.value = stringify(2), .value = "2",
}, },
}; };
@ -904,19 +904,19 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m)
},{ },{
.driver = "AC97", .driver = "AC97",
.property = "use_broken_id", .property = "use_broken_id",
.value = stringify(1), .value = "1",
},{ },{
.driver = "virtio-9p-pci", .driver = "virtio-9p-pci",
.property = "vectors", .property = "vectors",
.value = stringify(0), .value = "0",
},{ },{
.driver = "VGA", .driver = "VGA",
.property = "rombar", .property = "rombar",
.value = stringify(0), .value = "0",
},{ },{
.driver = "vmware-svga", .driver = "vmware-svga",
.property = "rombar", .property = "rombar",
.value = stringify(0), .value = "0",
}, },
}; };
@ -936,11 +936,11 @@ static void pc_i440fx_0_12_machine_options(MachineClass *m)
{ {
.driver = "virtio-serial-pci", .driver = "virtio-serial-pci",
.property = "max_ports", .property = "max_ports",
.value = stringify(1), .value = "1",
},{ },{
.driver = "virtio-serial-pci", .driver = "virtio-serial-pci",
.property = "vectors", .property = "vectors",
.value = stringify(0), .value = "0",
},{ },{
.driver = "usb-mouse", .driver = "usb-mouse",
.property = "serial", .property = "serial",

View File

@ -4324,7 +4324,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)
{ {
.driver = TYPE_SPAPR_PCI_HOST_BRIDGE, .driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
.property = "ddw", .property = "ddw",
.value = stringify(off), .value = "off",
}, },
}; };