mirror of https://gitee.com/openkylin/qemu.git
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:
parent
b3bcb3cedf
commit
e0985450e1
|
@ -135,11 +135,11 @@ GlobalProperty hw_compat_2_8[] = {
|
|||
{
|
||||
.driver = "fw_cfg_mem",
|
||||
.property = "x-file-slots",
|
||||
.value = stringify(0x10),
|
||||
.value = "0x10",
|
||||
},{
|
||||
.driver = "fw_cfg_io",
|
||||
.property = "x-file-slots",
|
||||
.value = stringify(0x10),
|
||||
.value = "0x10",
|
||||
},{
|
||||
.driver = "pflash_cfi01",
|
||||
.property = "old-multiple-chip-handling",
|
||||
|
@ -337,11 +337,11 @@ GlobalProperty hw_compat_2_1[] = {
|
|||
},{
|
||||
.driver = "usb-mouse",
|
||||
.property = "usb_version",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},{
|
||||
.driver = "usb-kbd",
|
||||
.property = "usb_version",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},{
|
||||
.driver = "virtio-pci",
|
||||
.property = "virtio-pci-bus-master-bug-migration",
|
||||
|
|
94
hw/i386/pc.c
94
hw/i386/pc.c
|
@ -148,11 +148,11 @@ GlobalProperty pc_compat_2_12[] = {
|
|||
},{
|
||||
.driver = "EPYC-" TYPE_X86_CPU,
|
||||
.property = "xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "EPYC-IBPB-" TYPE_X86_CPU,
|
||||
.property = "xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},
|
||||
};
|
||||
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",
|
||||
.property = "extended-tseg-mbytes",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},
|
||||
};
|
||||
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,
|
||||
.property = "min-level",
|
||||
.value = stringify(4),
|
||||
.value = "4",
|
||||
},{
|
||||
.driver = "kvm64" "-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(5),
|
||||
.value = "5",
|
||||
},{
|
||||
.driver = "pentium3" "-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "n270" "-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(5),
|
||||
.value = "5",
|
||||
},{
|
||||
.driver = "Conroe" "-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(4),
|
||||
.value = "4",
|
||||
},{
|
||||
.driver = "Penryn" "-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(4),
|
||||
.value = "4",
|
||||
},{
|
||||
.driver = "Nehalem" "-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(4),
|
||||
.value = "4",
|
||||
},{
|
||||
.driver = "n270" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Penryn" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Conroe" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Nehalem" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Westmere" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "SandyBridge" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "IvyBridge" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Haswell" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Haswell-noTSX" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Broadwell" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = "Broadwell-noTSX" "-" TYPE_X86_CPU,
|
||||
.property = "min-xlevel",
|
||||
.value = stringify(0x8000000a),
|
||||
.value = "0x8000000a",
|
||||
},{
|
||||
.driver = TYPE_X86_CPU,
|
||||
.property = "kvm-no-smi-migration",
|
||||
|
@ -566,7 +566,7 @@ GlobalProperty pc_compat_2_0[] = {
|
|||
{
|
||||
.driver = "apic",
|
||||
.property = "version",
|
||||
.value = stringify(0x11),
|
||||
.value = "0x11",
|
||||
},
|
||||
{
|
||||
.driver = "nec-usb-xhci",
|
||||
|
@ -581,17 +581,17 @@ GlobalProperty pc_compat_2_0[] = {
|
|||
{
|
||||
.driver = "pci-serial",
|
||||
.property = "prog_if",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},
|
||||
{
|
||||
.driver = "pci-serial-2x",
|
||||
.property = "prog_if",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},
|
||||
{
|
||||
.driver = "pci-serial-4x",
|
||||
.property = "prog_if",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},
|
||||
{
|
||||
.driver = "virtio-net-pci",
|
||||
|
@ -629,7 +629,7 @@ GlobalProperty pc_compat_1_7[] = {
|
|||
{
|
||||
.driver = "hpet",
|
||||
.property = HPET_INTCAP,
|
||||
.value = stringify(4),
|
||||
.value = "4",
|
||||
},
|
||||
};
|
||||
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,
|
||||
.property = "model",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "qemu32-" TYPE_X86_CPU,
|
||||
.property = "model",
|
||||
.value = stringify(3),
|
||||
.value = "3",
|
||||
},{
|
||||
.driver = "i440FX-pcihost",
|
||||
.property = "short_root_bus",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},{
|
||||
.driver = "q35-pcihost",
|
||||
.property = "short_root_bus",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},
|
||||
};
|
||||
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,
|
||||
.property = "model",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "Conroe-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "Penryn-" TYPE_X86_CPU,
|
||||
.property = "model",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "Penryn-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "Nehalem-" TYPE_X86_CPU,
|
||||
.property = "model",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "Nehalem-" TYPE_X86_CPU,
|
||||
.property = "min-level",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "virtio-net-pci",
|
||||
.property = "any_layout",
|
||||
|
@ -697,11 +697,11 @@ GlobalProperty pc_compat_1_5[] = {
|
|||
},{
|
||||
.driver = "i440FX-pcihost",
|
||||
.property = "short_root_bus",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "q35-pcihost",
|
||||
.property = "short_root_bus",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},
|
||||
};
|
||||
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",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "scsi-cd",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "scsi-disk",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "ide-hd",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "ide-cd",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "ide-drive",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "virtio-blk-pci",
|
||||
.property = "discard_granularity",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "virtio-serial-pci",
|
||||
.property = "vectors",
|
||||
/* DEV_NVECTORS_UNSPECIFIED as a uint32_t string */
|
||||
.value = stringify(0xFFFFFFFF),
|
||||
.value = "0xFFFFFFFF",
|
||||
},{
|
||||
.driver = "virtio-net-pci",
|
||||
.property = "ctrl_guest_offloads",
|
||||
|
@ -768,7 +768,7 @@ GlobalProperty pc_compat_1_4[] = {
|
|||
},{
|
||||
.driver = "486-" TYPE_X86_CPU,
|
||||
.property = "model",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},
|
||||
{
|
||||
.driver = "n270" "-" TYPE_X86_CPU,
|
||||
|
|
|
@ -697,7 +697,7 @@ static void pc_i440fx_1_3_machine_options(MachineClass *m)
|
|||
{
|
||||
.driver = "usb-tablet",
|
||||
.property = "usb_version",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},{
|
||||
.driver = "virtio-net-pci",
|
||||
.property = "ctrl_mac_addr",
|
||||
|
@ -741,11 +741,11 @@ static void pc_i440fx_1_2_machine_options(MachineClass *m)
|
|||
},{
|
||||
.driver = "qxl",
|
||||
.property = "revision",
|
||||
.value = stringify(3),
|
||||
.value = "3",
|
||||
},{
|
||||
.driver = "qxl-vga",
|
||||
.property = "revision",
|
||||
.value = stringify(3),
|
||||
.value = "3",
|
||||
},{
|
||||
.driver = "VGA",
|
||||
.property = "mmio",
|
||||
|
@ -777,19 +777,19 @@ static void pc_i440fx_1_1_machine_options(MachineClass *m)
|
|||
},{
|
||||
.driver = "VGA",
|
||||
.property = "vgamem_mb",
|
||||
.value = stringify(8),
|
||||
.value = "8",
|
||||
},{
|
||||
.driver = "vmware-svga",
|
||||
.property = "vgamem_mb",
|
||||
.value = stringify(8),
|
||||
.value = "8",
|
||||
},{
|
||||
.driver = "qxl-vga",
|
||||
.property = "vgamem_mb",
|
||||
.value = stringify(8),
|
||||
.value = "8",
|
||||
},{
|
||||
.driver = "qxl",
|
||||
.property = "vgamem_mb",
|
||||
.value = stringify(8),
|
||||
.value = "8",
|
||||
},{
|
||||
.driver = "virtio-blk-pci",
|
||||
.property = "config-wce",
|
||||
|
@ -876,11 +876,11 @@ static void pc_i440fx_0_14_machine_options(MachineClass *m)
|
|||
},{
|
||||
.driver = "qxl",
|
||||
.property = "revision",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},{
|
||||
.driver = "qxl-vga",
|
||||
.property = "revision",
|
||||
.value = stringify(2),
|
||||
.value = "2",
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -904,19 +904,19 @@ static void pc_i440fx_0_13_machine_options(MachineClass *m)
|
|||
},{
|
||||
.driver = "AC97",
|
||||
.property = "use_broken_id",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},{
|
||||
.driver = "virtio-9p-pci",
|
||||
.property = "vectors",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "VGA",
|
||||
.property = "rombar",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "vmware-svga",
|
||||
.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",
|
||||
.property = "max_ports",
|
||||
.value = stringify(1),
|
||||
.value = "1",
|
||||
},{
|
||||
.driver = "virtio-serial-pci",
|
||||
.property = "vectors",
|
||||
.value = stringify(0),
|
||||
.value = "0",
|
||||
},{
|
||||
.driver = "usb-mouse",
|
||||
.property = "serial",
|
||||
|
|
|
@ -4324,7 +4324,7 @@ static void spapr_machine_2_6_class_options(MachineClass *mc)
|
|||
{
|
||||
.driver = TYPE_SPAPR_PCI_HOST_BRIDGE,
|
||||
.property = "ddw",
|
||||
.value = stringify(off),
|
||||
.value = "off",
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue