diff mbox series

[29/71] hw/i386: Constify all Property

Message ID 20241213190750.2513964-34-richard.henderson@linaro.org (mailing list archive)
State New
Headers show
Series whole-tree: Constify Property structures | expand

Commit Message

Richard Henderson Dec. 13, 2024, 7:07 p.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 hw/i386/amd_iommu.c        | 2 +-
 hw/i386/intel_iommu.c      | 2 +-
 hw/i386/kvm/clock.c        | 2 +-
 hw/i386/kvm/i8254.c        | 2 +-
 hw/i386/kvm/ioapic.c       | 2 +-
 hw/i386/sgx-epc.c          | 2 +-
 hw/i386/vmmouse.c          | 2 +-
 hw/i386/vmport.c           | 2 +-
 hw/i386/x86-iommu.c        | 2 +-
 hw/i386/xen/xen_pvdevice.c | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

Comments

CLEMENT MATHIEU--DRIF Dec. 16, 2024, 6:14 a.m. UTC | #1
Hi Rihard.

Good idea, LGTM.

Just out of curiosity, what was the motivation for such a patch?
It it simply about cleaning the code or is it intended to solve a deeper 
problem.

Thanks,
cmd


On 13/12/2024 20:07, Richard Henderson wrote:
> Caution: External email. Do not open attachments or click links, unless this email comes from a known sender and you know the content is safe.
>
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   hw/i386/amd_iommu.c        | 2 +-
>   hw/i386/intel_iommu.c      | 2 +-
>   hw/i386/kvm/clock.c        | 2 +-
>   hw/i386/kvm/i8254.c        | 2 +-
>   hw/i386/kvm/ioapic.c       | 2 +-
>   hw/i386/sgx-epc.c          | 2 +-
>   hw/i386/vmmouse.c          | 2 +-
>   hw/i386/vmport.c           | 2 +-
>   hw/i386/x86-iommu.c        | 2 +-
>   hw/i386/xen/xen_pvdevice.c | 2 +-
>   10 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
> index af0f4da1f6..ca3e62a244 100644
> --- a/hw/i386/amd_iommu.c
> +++ b/hw/i386/amd_iommu.c
> @@ -1668,7 +1668,7 @@ static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
>       amdvi_init(s);
>   }
>
> -static Property amdvi_properties[] = {
> +static const Property amdvi_properties[] = {
>       DEFINE_PROP_BOOL("xtsup", AMDVIState, xtsup, false),
>       DEFINE_PROP_END_OF_LIST(),
>   };
> diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
> index 4c0d1d7d47..a5b268342f 100644
> --- a/hw/i386/intel_iommu.c
> +++ b/hw/i386/intel_iommu.c
> @@ -3404,7 +3404,7 @@ static const MemoryRegionOps vtd_mem_ops = {
>       },
>   };
>
> -static Property vtd_properties[] = {
> +static const Property vtd_properties[] = {
>       DEFINE_PROP_UINT32("version", IntelIOMMUState, version, 0),
>       DEFINE_PROP_ON_OFF_AUTO("eim", IntelIOMMUState, intr_eim,
>                               ON_OFF_AUTO_AUTO),
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 40aa9a32c3..71150ed2e0 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -305,7 +305,7 @@ static const VMStateDescription kvmclock_vmsd = {
>       }
>   };
>
> -static Property kvmclock_properties[] = {
> +static const Property kvmclock_properties[] = {
>       DEFINE_PROP_BOOL("x-mach-use-reliable-get-clock", KVMClockState,
>                         mach_use_reliable_get_clock, true),
>       DEFINE_PROP_END_OF_LIST(),
> diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
> index baa4b39582..2933d3f458 100644
> --- a/hw/i386/kvm/i8254.c
> +++ b/hw/i386/kvm/i8254.c
> @@ -287,7 +287,7 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
>       kpc->parent_realize(dev, errp);
>   }
>
> -static Property kvm_pit_properties[] = {
> +static const Property kvm_pit_properties[] = {
>       DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
>                                  lost_tick_policy, LOST_TICK_POLICY_DELAY),
>       DEFINE_PROP_END_OF_LIST(),
> diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c
> index 2907b08164..217ff43b98 100644
> --- a/hw/i386/kvm/ioapic.c
> +++ b/hw/i386/kvm/ioapic.c
> @@ -133,7 +133,7 @@ static void kvm_ioapic_realize(DeviceState *dev, Error **errp)
>       qdev_init_gpio_in(dev, kvm_ioapic_set_irq, IOAPIC_NUM_PINS);
>   }
>
> -static Property kvm_ioapic_properties[] = {
> +static const Property kvm_ioapic_properties[] = {
>       DEFINE_PROP_UINT32("gsi_base", KVMIOAPICState, kvm_gsi_base, 0),
>       DEFINE_PROP_END_OF_LIST()
>   };
> diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
> index d664829d35..c232e825e0 100644
> --- a/hw/i386/sgx-epc.c
> +++ b/hw/i386/sgx-epc.c
> @@ -19,7 +19,7 @@
>   #include "target/i386/cpu.h"
>   #include "exec/address-spaces.h"
>
> -static Property sgx_epc_properties[] = {
> +static const Property sgx_epc_properties[] = {
>       DEFINE_PROP_UINT64(SGX_EPC_ADDR_PROP, SGXEPCDevice, addr, 0),
>       DEFINE_PROP_UINT32(SGX_EPC_NUMA_NODE_PROP, SGXEPCDevice, node, 0),
>       DEFINE_PROP_LINK(SGX_EPC_MEMDEV_PROP, SGXEPCDevice, hostmem,
> diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
> index 76130cd46d..da9c35c1ec 100644
> --- a/hw/i386/vmmouse.c
> +++ b/hw/i386/vmmouse.c
> @@ -317,7 +317,7 @@ static void vmmouse_realizefn(DeviceState *dev, Error **errp)
>       vmport_register(VMPORT_CMD_VMMOUSE_DATA, vmmouse_ioport_read, s);
>   }
>
> -static Property vmmouse_properties[] = {
> +static const Property vmmouse_properties[] = {
>       DEFINE_PROP_LINK("i8042", VMMouseState, i8042, TYPE_I8042, ISAKBDState *),
>       DEFINE_PROP_END_OF_LIST(),
>   };
> diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
> index 7cc75dbc6d..cab6e72089 100644
> --- a/hw/i386/vmport.c
> +++ b/hw/i386/vmport.c
> @@ -252,7 +252,7 @@ static void vmport_realizefn(DeviceState *dev, Error **errp)
>       }
>   }
>
> -static Property vmport_properties[] = {
> +static const Property vmport_properties[] = {
>       /* Used to enforce compatibility for migration */
>       DEFINE_PROP_BIT("x-read-set-eax", VMPortState, compat_flags,
>                       VMPORT_COMPAT_READ_SET_EAX_BIT, true),
> diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c
> index 60af896225..155f6262ea 100644
> --- a/hw/i386/x86-iommu.c
> +++ b/hw/i386/x86-iommu.c
> @@ -125,7 +125,7 @@ static void x86_iommu_realize(DeviceState *dev, Error **errp)
>       }
>   }
>
> -static Property x86_iommu_properties[] = {
> +static const Property x86_iommu_properties[] = {
>       DEFINE_PROP_ON_OFF_AUTO("intremap", X86IOMMUState,
>                               intr_supported, ON_OFF_AUTO_AUTO),
>       DEFINE_PROP_BOOL("device-iotlb", X86IOMMUState, dt_supported, false),
> diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
> index ed621531d8..e71483e6e3 100644
> --- a/hw/i386/xen/xen_pvdevice.c
> +++ b/hw/i386/xen/xen_pvdevice.c
> @@ -115,7 +115,7 @@ static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
>                        &d->mmio);
>   }
>
> -static Property xen_pv_props[] = {
> +static const Property xen_pv_props[] = {
>       DEFINE_PROP_UINT16("vendor-id", XenPVDevice, vendor_id, PCI_VENDOR_ID_XEN),
>       DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, 0xffff),
>       DEFINE_PROP_UINT8("revision", XenPVDevice, revision, 0x01),
> --
> 2.43.0
>
Richard Henderson Dec. 16, 2024, 2:05 p.m. UTC | #2
On 12/16/24 00:14, CLEMENT MATHIEU--DRIF wrote:
> Hi Rihard.
> 
> Good idea, LGTM.
> 
> Just out of curiosity, what was the motivation for such a patch?
> It it simply about cleaning the code or is it intended to solve a deeper
> problem.

Simply cleaning the code, prompted by a change to core QAPI code for Rust enablement.


r~
diff mbox series

Patch

diff --git a/hw/i386/amd_iommu.c b/hw/i386/amd_iommu.c
index af0f4da1f6..ca3e62a244 100644
--- a/hw/i386/amd_iommu.c
+++ b/hw/i386/amd_iommu.c
@@ -1668,7 +1668,7 @@  static void amdvi_sysbus_realize(DeviceState *dev, Error **errp)
     amdvi_init(s);
 }
 
-static Property amdvi_properties[] = {
+static const Property amdvi_properties[] = {
     DEFINE_PROP_BOOL("xtsup", AMDVIState, xtsup, false),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 4c0d1d7d47..a5b268342f 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3404,7 +3404,7 @@  static const MemoryRegionOps vtd_mem_ops = {
     },
 };
 
-static Property vtd_properties[] = {
+static const Property vtd_properties[] = {
     DEFINE_PROP_UINT32("version", IntelIOMMUState, version, 0),
     DEFINE_PROP_ON_OFF_AUTO("eim", IntelIOMMUState, intr_eim,
                             ON_OFF_AUTO_AUTO),
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 40aa9a32c3..71150ed2e0 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -305,7 +305,7 @@  static const VMStateDescription kvmclock_vmsd = {
     }
 };
 
-static Property kvmclock_properties[] = {
+static const Property kvmclock_properties[] = {
     DEFINE_PROP_BOOL("x-mach-use-reliable-get-clock", KVMClockState,
                       mach_use_reliable_get_clock, true),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index baa4b39582..2933d3f458 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -287,7 +287,7 @@  static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
     kpc->parent_realize(dev, errp);
 }
 
-static Property kvm_pit_properties[] = {
+static const Property kvm_pit_properties[] = {
     DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
                                lost_tick_policy, LOST_TICK_POLICY_DELAY),
     DEFINE_PROP_END_OF_LIST(),
diff --git a/hw/i386/kvm/ioapic.c b/hw/i386/kvm/ioapic.c
index 2907b08164..217ff43b98 100644
--- a/hw/i386/kvm/ioapic.c
+++ b/hw/i386/kvm/ioapic.c
@@ -133,7 +133,7 @@  static void kvm_ioapic_realize(DeviceState *dev, Error **errp)
     qdev_init_gpio_in(dev, kvm_ioapic_set_irq, IOAPIC_NUM_PINS);
 }
 
-static Property kvm_ioapic_properties[] = {
+static const Property kvm_ioapic_properties[] = {
     DEFINE_PROP_UINT32("gsi_base", KVMIOAPICState, kvm_gsi_base, 0),
     DEFINE_PROP_END_OF_LIST()
 };
diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
index d664829d35..c232e825e0 100644
--- a/hw/i386/sgx-epc.c
+++ b/hw/i386/sgx-epc.c
@@ -19,7 +19,7 @@ 
 #include "target/i386/cpu.h"
 #include "exec/address-spaces.h"
 
-static Property sgx_epc_properties[] = {
+static const Property sgx_epc_properties[] = {
     DEFINE_PROP_UINT64(SGX_EPC_ADDR_PROP, SGXEPCDevice, addr, 0),
     DEFINE_PROP_UINT32(SGX_EPC_NUMA_NODE_PROP, SGXEPCDevice, node, 0),
     DEFINE_PROP_LINK(SGX_EPC_MEMDEV_PROP, SGXEPCDevice, hostmem,
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index 76130cd46d..da9c35c1ec 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -317,7 +317,7 @@  static void vmmouse_realizefn(DeviceState *dev, Error **errp)
     vmport_register(VMPORT_CMD_VMMOUSE_DATA, vmmouse_ioport_read, s);
 }
 
-static Property vmmouse_properties[] = {
+static const Property vmmouse_properties[] = {
     DEFINE_PROP_LINK("i8042", VMMouseState, i8042, TYPE_I8042, ISAKBDState *),
     DEFINE_PROP_END_OF_LIST(),
 };
diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 7cc75dbc6d..cab6e72089 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -252,7 +252,7 @@  static void vmport_realizefn(DeviceState *dev, Error **errp)
     }
 }
 
-static Property vmport_properties[] = {
+static const Property vmport_properties[] = {
     /* Used to enforce compatibility for migration */
     DEFINE_PROP_BIT("x-read-set-eax", VMPortState, compat_flags,
                     VMPORT_COMPAT_READ_SET_EAX_BIT, true),
diff --git a/hw/i386/x86-iommu.c b/hw/i386/x86-iommu.c
index 60af896225..155f6262ea 100644
--- a/hw/i386/x86-iommu.c
+++ b/hw/i386/x86-iommu.c
@@ -125,7 +125,7 @@  static void x86_iommu_realize(DeviceState *dev, Error **errp)
     }
 }
 
-static Property x86_iommu_properties[] = {
+static const Property x86_iommu_properties[] = {
     DEFINE_PROP_ON_OFF_AUTO("intremap", X86IOMMUState,
                             intr_supported, ON_OFF_AUTO_AUTO),
     DEFINE_PROP_BOOL("device-iotlb", X86IOMMUState, dt_supported, false),
diff --git a/hw/i386/xen/xen_pvdevice.c b/hw/i386/xen/xen_pvdevice.c
index ed621531d8..e71483e6e3 100644
--- a/hw/i386/xen/xen_pvdevice.c
+++ b/hw/i386/xen/xen_pvdevice.c
@@ -115,7 +115,7 @@  static void xen_pv_realize(PCIDevice *pci_dev, Error **errp)
                      &d->mmio);
 }
 
-static Property xen_pv_props[] = {
+static const Property xen_pv_props[] = {
     DEFINE_PROP_UINT16("vendor-id", XenPVDevice, vendor_id, PCI_VENDOR_ID_XEN),
     DEFINE_PROP_UINT16("device-id", XenPVDevice, device_id, 0xffff),
     DEFINE_PROP_UINT8("revision", XenPVDevice, revision, 0x01),