All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Mark remaining global TypeInfo instances as const
@ 2022-01-13 17:10 Bernhard Beschow
  2022-01-13 22:11 ` Alistair Francis
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Bernhard Beschow @ 2022-01-13 17:10 UTC (permalink / raw)
  To: qemu-devel
  Cc: Fam Zheng, Peter Maydell, Matthew Rosato, Michael S. Tsirkin,
	Jason Wang, David Hildenbrand, Thomas Huth, Laurent Vivier,
	Gerd Hoffmann, Ani Sinha, Edgar E. Iglesias, qemu-trivial,
	Daniel Henrique Barboza, Havard Skinnemoen, Halil Pasic,
	Hervé Poussineau, Joel Stanley, Christian Borntraeger,
	Bernhard Beschow, Eric Farman, Corey Minyard, open list:S390 PCI,
	Alistair Francis, Richard Henderson, Greg Kurz,
	Beniamino Galvani, Alex Williamson, open list:Raspberry Pi,
	Cédric Le Goater, Paolo Bonzini, Alex Bennée,
	David Gibson, Eduardo Habkost, Daniel P. Berrangé,
	Xiao Guangrong, Andrew Jeffery, Cornelia Huck,
	Philippe Mathieu-Daudé,
	Andrew Baumann, Tyrone Ting, open list:e500, Igor Mammedov

More than 1k of TypeInfo instances are already marked as const. Mark the
remaining ones, too.

Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
 hw/core/generic-loader.c   | 2 +-
 hw/core/guest-loader.c     | 2 +-
 hw/display/bcm2835_fb.c    | 2 +-
 hw/display/i2c-ddc.c       | 2 +-
 hw/display/macfb.c         | 4 ++--
 hw/display/virtio-vga.c    | 2 +-
 hw/dma/bcm2835_dma.c       | 2 +-
 hw/i386/pc_piix.c          | 2 +-
 hw/i386/sgx-epc.c          | 2 +-
 hw/intc/bcm2835_ic.c       | 2 +-
 hw/intc/bcm2836_control.c  | 2 +-
 hw/ipmi/ipmi.c             | 4 ++--
 hw/mem/nvdimm.c            | 2 +-
 hw/mem/pc-dimm.c           | 2 +-
 hw/misc/bcm2835_mbox.c     | 2 +-
 hw/misc/bcm2835_powermgt.c | 2 +-
 hw/misc/bcm2835_property.c | 2 +-
 hw/misc/bcm2835_rng.c      | 2 +-
 hw/misc/pvpanic-isa.c      | 2 +-
 hw/misc/pvpanic-pci.c      | 2 +-
 hw/net/fsl_etsec/etsec.c   | 2 +-
 hw/ppc/prep_systemio.c     | 2 +-
 hw/ppc/spapr_iommu.c       | 2 +-
 hw/s390x/s390-pci-bus.c    | 2 +-
 hw/s390x/sclp.c            | 2 +-
 hw/s390x/tod-kvm.c         | 2 +-
 hw/s390x/tod-tcg.c         | 2 +-
 hw/s390x/tod.c             | 2 +-
 hw/scsi/lsi53c895a.c       | 2 +-
 hw/sd/allwinner-sdhost.c   | 2 +-
 hw/sd/aspeed_sdhci.c       | 2 +-
 hw/sd/bcm2835_sdhost.c     | 2 +-
 hw/sd/cadence_sdhci.c      | 2 +-
 hw/sd/npcm7xx_sdhci.c      | 2 +-
 hw/usb/dev-mtp.c           | 2 +-
 hw/usb/host-libusb.c       | 2 +-
 hw/vfio/igd.c              | 2 +-
 hw/virtio/virtio-pmem.c    | 2 +-
 qom/object.c               | 4 ++--
 39 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
index 9a24ffb880..eaafc416f4 100644
--- a/hw/core/generic-loader.c
+++ b/hw/core/generic-loader.c
@@ -207,7 +207,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
-static TypeInfo generic_loader_info = {
+static const TypeInfo generic_loader_info = {
     .name = TYPE_GENERIC_LOADER,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(GenericLoaderState),
diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
index d3f9d1a06e..391c875a29 100644
--- a/hw/core/guest-loader.c
+++ b/hw/core/guest-loader.c
@@ -129,7 +129,7 @@ static void guest_loader_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
-static TypeInfo guest_loader_info = {
+static const TypeInfo guest_loader_info = {
     .name = TYPE_GUEST_LOADER,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(GuestLoaderState),
diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
index 2be77bdd3a..088fc3d51c 100644
--- a/hw/display/bcm2835_fb.c
+++ b/hw/display/bcm2835_fb.c
@@ -454,7 +454,7 @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_fb;
 }
 
-static TypeInfo bcm2835_fb_info = {
+static const TypeInfo bcm2835_fb_info = {
     .name          = TYPE_BCM2835_FB,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835FBState),
diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c
index 13eb529fc1..146489518c 100644
--- a/hw/display/i2c-ddc.c
+++ b/hw/display/i2c-ddc.c
@@ -113,7 +113,7 @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data)
     isc->send = i2c_ddc_tx;
 }
 
-static TypeInfo i2c_ddc_info = {
+static const TypeInfo i2c_ddc_info = {
     .name = TYPE_I2CDDC,
     .parent = TYPE_I2C_SLAVE,
     .instance_size = sizeof(I2CDDCState),
diff --git a/hw/display/macfb.c b/hw/display/macfb.c
index 4bd7c3ad6a..69c2ea2b6e 100644
--- a/hw/display/macfb.c
+++ b/hw/display/macfb.c
@@ -783,14 +783,14 @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data)
     device_class_set_props(dc, macfb_nubus_properties);
 }
 
-static TypeInfo macfb_sysbus_info = {
+static const TypeInfo macfb_sysbus_info = {
     .name          = TYPE_MACFB,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(MacfbSysBusState),
     .class_init    = macfb_sysbus_class_init,
 };
 
-static TypeInfo macfb_nubus_info = {
+static const TypeInfo macfb_nubus_info = {
     .name          = TYPE_NUBUS_MACFB,
     .parent        = TYPE_NUBUS_DEVICE,
     .instance_size = sizeof(MacfbNubusState),
diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
index b23a75a04b..5a2f7a4540 100644
--- a/hw/display/virtio-vga.c
+++ b/hw/display/virtio-vga.c
@@ -220,7 +220,7 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
                                    virtio_vga_set_big_endian_fb);
 }
 
-static TypeInfo virtio_vga_base_info = {
+static const TypeInfo virtio_vga_base_info = {
     .name          = TYPE_VIRTIO_VGA_BASE,
     .parent        = TYPE_VIRTIO_PCI,
     .instance_size = sizeof(VirtIOVGABase),
diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
index eb0002a2b9..5e9306110d 100644
--- a/hw/dma/bcm2835_dma.c
+++ b/hw/dma/bcm2835_dma.c
@@ -394,7 +394,7 @@ static void bcm2835_dma_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_dma;
 }
 
-static TypeInfo bcm2835_dma_info = {
+static const TypeInfo bcm2835_dma_info = {
     .name          = TYPE_BCM2835_DMA,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835DMAState),
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7c7790a5ce..f6557d3c21 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -865,7 +865,7 @@ static void isa_bridge_class_init(ObjectClass *klass, void *data)
     k->class_id     = PCI_CLASS_BRIDGE_ISA;
 };
 
-static TypeInfo isa_bridge_info = {
+static const TypeInfo isa_bridge_info = {
     .name          = "igd-passthrough-isa-bridge",
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PCIDevice),
diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
index 96b2940d75..d664829d35 100644
--- a/hw/i386/sgx-epc.c
+++ b/hw/i386/sgx-epc.c
@@ -167,7 +167,7 @@ static void sgx_epc_class_init(ObjectClass *oc, void *data)
     mdc->fill_device_info = sgx_epc_md_fill_device_info;
 }
 
-static TypeInfo sgx_epc_info = {
+static const TypeInfo sgx_epc_info = {
     .name          = TYPE_SGX_EPC,
     .parent        = TYPE_DEVICE,
     .instance_size = sizeof(SGXEPCDevice),
diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
index 9000d995e8..4513fad16f 100644
--- a/hw/intc/bcm2835_ic.c
+++ b/hw/intc/bcm2835_ic.c
@@ -227,7 +227,7 @@ static void bcm2835_ic_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_ic;
 }
 
-static TypeInfo bcm2835_ic_info = {
+static const TypeInfo bcm2835_ic_info = {
     .name          = TYPE_BCM2835_IC,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835ICState),
diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
index 2ead76ffdc..b0589df188 100644
--- a/hw/intc/bcm2836_control.c
+++ b/hw/intc/bcm2836_control.c
@@ -392,7 +392,7 @@ static void bcm2836_control_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2836_control;
 }
 
-static TypeInfo bcm2836_control_info = {
+static const TypeInfo bcm2836_control_info = {
     .name          = TYPE_BCM2836_CONTROL,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2836ControlState),
diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
index 8d35c9fdd6..bbb07b151e 100644
--- a/hw/ipmi/ipmi.c
+++ b/hw/ipmi/ipmi.c
@@ -85,7 +85,7 @@ static void ipmi_interface_class_init(ObjectClass *class, void *data)
     ik->do_hw_op = ipmi_do_hw_op;
 }
 
-static TypeInfo ipmi_interface_type_info = {
+static const TypeInfo ipmi_interface_type_info = {
     .name = TYPE_IPMI_INTERFACE,
     .parent = TYPE_INTERFACE,
     .class_size = sizeof(IPMIInterfaceClass),
@@ -120,7 +120,7 @@ static void bmc_class_init(ObjectClass *oc, void *data)
     device_class_set_props(dc, ipmi_bmc_properties);
 }
 
-static TypeInfo ipmi_bmc_type_info = {
+static const TypeInfo ipmi_bmc_type_info = {
     .name = TYPE_IPMI_BMC,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(IPMIBmc),
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 7397b67156..933bc5e0c7 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -248,7 +248,7 @@ static void nvdimm_class_init(ObjectClass *oc, void *data)
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
 }
 
-static TypeInfo nvdimm_info = {
+static const TypeInfo nvdimm_info = {
     .name          = TYPE_NVDIMM,
     .parent        = TYPE_PC_DIMM,
     .class_size    = sizeof(NVDIMMClass),
diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
index 48b913aba6..28af0d71b2 100644
--- a/hw/mem/pc-dimm.c
+++ b/hw/mem/pc-dimm.c
@@ -286,7 +286,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
     mdc->fill_device_info = pc_dimm_md_fill_device_info;
 }
 
-static TypeInfo pc_dimm_info = {
+static const TypeInfo pc_dimm_info = {
     .name          = TYPE_PC_DIMM,
     .parent        = TYPE_DEVICE,
     .instance_size = sizeof(PCDIMMDevice),
diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
index 9f73cbd5e4..1908c152f6 100644
--- a/hw/misc/bcm2835_mbox.c
+++ b/hw/misc/bcm2835_mbox.c
@@ -324,7 +324,7 @@ static void bcm2835_mbox_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_mbox;
 }
 
-static TypeInfo bcm2835_mbox_info = {
+static const TypeInfo bcm2835_mbox_info = {
     .name          = TYPE_BCM2835_MBOX,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835MboxState),
diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c
index 25fa804cbd..976f3d34e5 100644
--- a/hw/misc/bcm2835_powermgt.c
+++ b/hw/misc/bcm2835_powermgt.c
@@ -144,7 +144,7 @@ static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_powermgt;
 }
 
-static TypeInfo bcm2835_powermgt_info = {
+static const TypeInfo bcm2835_powermgt_info = {
     .name          = TYPE_BCM2835_POWERMGT,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835PowerMgtState),
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 76ea511d53..e94e951057 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -421,7 +421,7 @@ static void bcm2835_property_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_property;
 }
 
-static TypeInfo bcm2835_property_info = {
+static const TypeInfo bcm2835_property_info = {
     .name          = TYPE_BCM2835_PROPERTY,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835PropertyState),
diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c
index d0c4e64e88..b3c80cf186 100644
--- a/hw/misc/bcm2835_rng.c
+++ b/hw/misc/bcm2835_rng.c
@@ -131,7 +131,7 @@ static void bcm2835_rng_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_rng;
 }
 
-static TypeInfo bcm2835_rng_info = {
+static const TypeInfo bcm2835_rng_info = {
     .name          = TYPE_BCM2835_RNG,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835RngState),
diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
index 7b66d58acc..a39fcdd1fc 100644
--- a/hw/misc/pvpanic-isa.c
+++ b/hw/misc/pvpanic-isa.c
@@ -77,7 +77,7 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
-static TypeInfo pvpanic_isa_info = {
+static const TypeInfo pvpanic_isa_info = {
     .name          = TYPE_PVPANIC_ISA_DEVICE,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(PVPanicISAState),
diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
index af8cbe2830..62e1be68c1 100644
--- a/hw/misc/pvpanic-pci.c
+++ b/hw/misc/pvpanic-pci.c
@@ -74,7 +74,7 @@ static void pvpanic_pci_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
-static TypeInfo pvpanic_pci_info = {
+static const TypeInfo pvpanic_pci_info = {
     .name          = TYPE_PVPANIC_PCI_DEVICE,
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PVPanicPCIState),
diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
index bd9d62b559..e7fc082518 100644
--- a/hw/net/fsl_etsec/etsec.c
+++ b/hw/net/fsl_etsec/etsec.c
@@ -430,7 +430,7 @@ static void etsec_class_init(ObjectClass *klass, void *data)
     dc->user_creatable = true;
 }
 
-static TypeInfo etsec_info = {
+static const TypeInfo etsec_info = {
     .name                  = TYPE_ETSEC_COMMON,
     .parent                = TYPE_SYS_BUS_DEVICE,
     .instance_size         = sizeof(eTSEC),
diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
index b2bd783248..8c9b8dd67b 100644
--- a/hw/ppc/prep_systemio.c
+++ b/hw/ppc/prep_systemio.c
@@ -300,7 +300,7 @@ static void prep_systemio_class_initfn(ObjectClass *klass, void *data)
     device_class_set_props(dc, prep_systemio_properties);
 }
 
-static TypeInfo prep_systemio800_info = {
+static const TypeInfo prep_systemio800_info = {
     .name          = TYPE_PREP_SYSTEMIO,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(PrepSystemIoState),
diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
index db01071858..81e5a1aea3 100644
--- a/hw/ppc/spapr_iommu.c
+++ b/hw/ppc/spapr_iommu.c
@@ -685,7 +685,7 @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
     spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce);
 }
 
-static TypeInfo spapr_tce_table_info = {
+static const TypeInfo spapr_tce_table_info = {
     .name = TYPE_SPAPR_TCE_TABLE,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(SpaprTceTable),
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
index 01b58ebc70..4b2bdd94b3 100644
--- a/hw/s390x/s390-pci-bus.c
+++ b/hw/s390x/s390-pci-bus.c
@@ -1392,7 +1392,7 @@ static const TypeInfo s390_pci_device_info = {
     .class_init = s390_pci_device_class_init,
 };
 
-static TypeInfo s390_pci_iommu_info = {
+static const TypeInfo s390_pci_iommu_info = {
     .name = TYPE_S390_PCI_IOMMU,
     .parent = TYPE_OBJECT,
     .instance_size = sizeof(S390PCIIOMMU),
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 89c30a8a91..eff74479f4 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -460,7 +460,7 @@ static void sclp_class_init(ObjectClass *oc, void *data)
     sc->service_interrupt = service_interrupt;
 }
 
-static TypeInfo sclp_info = {
+static const TypeInfo sclp_info = {
     .name = TYPE_SCLP,
     .parent = TYPE_DEVICE,
     .instance_init = sclp_init,
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
index ec855811ae..9d0cbfbce2 100644
--- a/hw/s390x/tod-kvm.c
+++ b/hw/s390x/tod-kvm.c
@@ -147,7 +147,7 @@ static void kvm_s390_tod_init(Object *obj)
     td->stopped = false;
 }
 
-static TypeInfo kvm_s390_tod_info = {
+static const TypeInfo kvm_s390_tod_info = {
     .name = TYPE_KVM_S390_TOD,
     .parent = TYPE_S390_TOD,
     .instance_size = sizeof(S390TODState),
diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c
index 9bb94ff72b..ad4993203d 100644
--- a/hw/s390x/tod-tcg.c
+++ b/hw/s390x/tod-tcg.c
@@ -73,7 +73,7 @@ static void qemu_s390_tod_init(Object *obj)
     }
 }
 
-static TypeInfo qemu_s390_tod_info = {
+static const TypeInfo qemu_s390_tod_info = {
     .name = TYPE_QEMU_S390_TOD,
     .parent = TYPE_S390_TOD,
     .instance_size = sizeof(S390TODState),
diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c
index fd5a36bf24..c81b1c0338 100644
--- a/hw/s390x/tod.c
+++ b/hw/s390x/tod.c
@@ -123,7 +123,7 @@ static void s390_tod_class_init(ObjectClass *oc, void *data)
     dc->user_creatable = false;
 }
 
-static TypeInfo s390_tod_info = {
+static const TypeInfo s390_tod_info = {
     .name = TYPE_S390_TOD,
     .parent = TYPE_DEVICE,
     .instance_size = sizeof(S390TODState),
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 4c431adb77..c8773f73f7 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2352,7 +2352,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
     k->device_id = PCI_DEVICE_ID_LSI_53C810;
 }
 
-static TypeInfo lsi53c810_info = {
+static const TypeInfo lsi53c810_info = {
     .name          = TYPE_LSI53C810,
     .parent        = TYPE_LSI53C895A,
     .class_init    = lsi53c810_class_init,
diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
index de5bc49e68..041e45c680 100644
--- a/hw/sd/allwinner-sdhost.c
+++ b/hw/sd/allwinner-sdhost.c
@@ -835,7 +835,7 @@ static void allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data)
     sc->max_desc_size = 64 * KiB;
 }
 
-static TypeInfo allwinner_sdhost_info = {
+static const TypeInfo allwinner_sdhost_info = {
     .name          = TYPE_AW_SDHOST,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_init = allwinner_sdhost_init,
diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
index df1bdf1fa4..be8cafd65f 100644
--- a/hw/sd/aspeed_sdhci.c
+++ b/hw/sd/aspeed_sdhci.c
@@ -198,7 +198,7 @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data)
     device_class_set_props(dc, aspeed_sdhci_properties);
 }
 
-static TypeInfo aspeed_sdhci_info = {
+static const TypeInfo aspeed_sdhci_info = {
     .name          = TYPE_ASPEED_SDHCI,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(AspeedSDHCIState),
diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
index 088a7ac6ed..9431c35914 100644
--- a/hw/sd/bcm2835_sdhost.c
+++ b/hw/sd/bcm2835_sdhost.c
@@ -436,7 +436,7 @@ static void bcm2835_sdhost_class_init(ObjectClass *klass, void *data)
     dc->vmsd = &vmstate_bcm2835_sdhost;
 }
 
-static TypeInfo bcm2835_sdhost_info = {
+static const TypeInfo bcm2835_sdhost_info = {
     .name          = TYPE_BCM2835_SDHOST,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(BCM2835SDHostState),
diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c
index 56b8bae1c3..75db34befe 100644
--- a/hw/sd/cadence_sdhci.c
+++ b/hw/sd/cadence_sdhci.c
@@ -175,7 +175,7 @@ static void cadence_sdhci_class_init(ObjectClass *classp, void *data)
     dc->vmsd = &vmstate_cadence_sdhci;
 }
 
-static TypeInfo cadence_sdhci_info = {
+static const TypeInfo cadence_sdhci_info = {
     .name          = TYPE_CADENCE_SDHCI,
     .parent        = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(CadenceSDHCIState),
diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c
index ef503365df..b2f5b4a542 100644
--- a/hw/sd/npcm7xx_sdhci.c
+++ b/hw/sd/npcm7xx_sdhci.c
@@ -166,7 +166,7 @@ static void npcm7xx_sdhci_instance_init(Object *obj)
                             TYPE_SYSBUS_SDHCI);
 }
 
-static TypeInfo npcm7xx_sdhci_info = {
+static const TypeInfo npcm7xx_sdhci_info = {
     .name = TYPE_NPCM7XX_SDHCI,
     .parent = TYPE_SYS_BUS_DEVICE,
     .instance_size = sizeof(NPCM7xxSDHCIState),
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index c1d1694fd0..1e6ac76bef 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -2106,7 +2106,7 @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data)
     device_class_set_props(dc, mtp_properties);
 }
 
-static TypeInfo mtp_info = {
+static const TypeInfo mtp_info = {
     .name          = TYPE_USB_MTP,
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(MTPState),
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index d0d46dd0a4..2b35cb6cdd 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1801,7 +1801,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
 }
 
-static TypeInfo usb_host_dev_info = {
+static const TypeInfo usb_host_dev_info = {
     .name          = TYPE_USB_HOST_DEVICE,
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBHostDevice),
diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
index d4685709a3..afe3fe7efc 100644
--- a/hw/vfio/igd.c
+++ b/hw/vfio/igd.c
@@ -199,7 +199,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data)
     k->class_id = PCI_CLASS_BRIDGE_ISA;
 }
 
-static TypeInfo vfio_pci_igd_lpc_bridge_info = {
+static const TypeInfo vfio_pci_igd_lpc_bridge_info = {
     .name = "vfio-pci-igd-lpc-bridge",
     .parent = TYPE_PCI_DEVICE,
     .class_init = vfio_pci_igd_lpc_bridge_class_init,
diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
index d1aeb90a31..5419dca75e 100644
--- a/hw/virtio/virtio-pmem.c
+++ b/hw/virtio/virtio-pmem.c
@@ -182,7 +182,7 @@ static void virtio_pmem_class_init(ObjectClass *klass, void *data)
     set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
 }
 
-static TypeInfo virtio_pmem_info = {
+static const TypeInfo virtio_pmem_info = {
     .name          = TYPE_VIRTIO_PMEM,
     .parent        = TYPE_VIRTIO_DEVICE,
     .class_size    = sizeof(VirtIOPMEMClass),
diff --git a/qom/object.c b/qom/object.c
index 4f0677cca9..9f7a33139d 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2793,13 +2793,13 @@ static void object_class_init(ObjectClass *klass, void *data)
 
 static void register_types(void)
 {
-    static TypeInfo interface_info = {
+    static const TypeInfo interface_info = {
         .name = TYPE_INTERFACE,
         .class_size = sizeof(InterfaceClass),
         .abstract = true,
     };
 
-    static TypeInfo object_info = {
+    static const TypeInfo object_info = {
         .name = TYPE_OBJECT,
         .instance_size = sizeof(Object),
         .class_init = object_class_init,
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark remaining global TypeInfo instances as const
  2022-01-13 17:10 [PATCH] Mark remaining global TypeInfo instances as const Bernhard Beschow
@ 2022-01-13 22:11 ` Alistair Francis
  2022-01-14  6:59 ` Thomas Huth
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alistair Francis @ 2022-01-13 22:11 UTC (permalink / raw)
  To: Bernhard Beschow
  Cc: Fam Zheng, Peter Maydell, Matthew Rosato, Michael S. Tsirkin,
	Eric Farman, Jason Wang, David Hildenbrand,
	qemu-devel@nongnu.org Developers, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Ani Sinha, Edgar E. Iglesias, Alex Williamson,
	QEMU Trivial, Daniel Henrique Barboza, Havard Skinnemoen,
	Halil Pasic, Hervé Poussineau, Joel Stanley,
	Christian Borntraeger, Thomas Huth, Corey Minyard,
	Alistair Francis, Richard Henderson, Greg Kurz,
	Beniamino Galvani, open list:S390 PCI, open list:Raspberry Pi,
	Cédric Le Goater, Igor Mammedov, Alex Bennée,
	David Gibson, Eduardo Habkost, Daniel P. Berrangé,
	Xiao Guangrong, Andrew Jeffery, Cornelia Huck, Laurent Vivier,
	Andrew Baumann, Tyrone Ting, open list:e500, Paolo Bonzini

On Fri, Jan 14, 2022 at 3:33 AM Bernhard Beschow <shentey@gmail.com> wrote:
>
> More than 1k of TypeInfo instances are already marked as const. Mark the
> remaining ones, too.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  hw/core/generic-loader.c   | 2 +-
>  hw/core/guest-loader.c     | 2 +-
>  hw/display/bcm2835_fb.c    | 2 +-
>  hw/display/i2c-ddc.c       | 2 +-
>  hw/display/macfb.c         | 4 ++--
>  hw/display/virtio-vga.c    | 2 +-
>  hw/dma/bcm2835_dma.c       | 2 +-
>  hw/i386/pc_piix.c          | 2 +-
>  hw/i386/sgx-epc.c          | 2 +-
>  hw/intc/bcm2835_ic.c       | 2 +-
>  hw/intc/bcm2836_control.c  | 2 +-
>  hw/ipmi/ipmi.c             | 4 ++--
>  hw/mem/nvdimm.c            | 2 +-
>  hw/mem/pc-dimm.c           | 2 +-
>  hw/misc/bcm2835_mbox.c     | 2 +-
>  hw/misc/bcm2835_powermgt.c | 2 +-
>  hw/misc/bcm2835_property.c | 2 +-
>  hw/misc/bcm2835_rng.c      | 2 +-
>  hw/misc/pvpanic-isa.c      | 2 +-
>  hw/misc/pvpanic-pci.c      | 2 +-
>  hw/net/fsl_etsec/etsec.c   | 2 +-
>  hw/ppc/prep_systemio.c     | 2 +-
>  hw/ppc/spapr_iommu.c       | 2 +-
>  hw/s390x/s390-pci-bus.c    | 2 +-
>  hw/s390x/sclp.c            | 2 +-
>  hw/s390x/tod-kvm.c         | 2 +-
>  hw/s390x/tod-tcg.c         | 2 +-
>  hw/s390x/tod.c             | 2 +-
>  hw/scsi/lsi53c895a.c       | 2 +-
>  hw/sd/allwinner-sdhost.c   | 2 +-
>  hw/sd/aspeed_sdhci.c       | 2 +-
>  hw/sd/bcm2835_sdhost.c     | 2 +-
>  hw/sd/cadence_sdhci.c      | 2 +-
>  hw/sd/npcm7xx_sdhci.c      | 2 +-
>  hw/usb/dev-mtp.c           | 2 +-
>  hw/usb/host-libusb.c       | 2 +-
>  hw/vfio/igd.c              | 2 +-
>  hw/virtio/virtio-pmem.c    | 2 +-
>  qom/object.c               | 4 ++--
>  39 files changed, 42 insertions(+), 42 deletions(-)
>
> diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
> index 9a24ffb880..eaafc416f4 100644
> --- a/hw/core/generic-loader.c
> +++ b/hw/core/generic-loader.c
> @@ -207,7 +207,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo generic_loader_info = {
> +static const TypeInfo generic_loader_info = {
>      .name = TYPE_GENERIC_LOADER,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(GenericLoaderState),
> diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
> index d3f9d1a06e..391c875a29 100644
> --- a/hw/core/guest-loader.c
> +++ b/hw/core/guest-loader.c
> @@ -129,7 +129,7 @@ static void guest_loader_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo guest_loader_info = {
> +static const TypeInfo guest_loader_info = {
>      .name = TYPE_GUEST_LOADER,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(GuestLoaderState),
> diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
> index 2be77bdd3a..088fc3d51c 100644
> --- a/hw/display/bcm2835_fb.c
> +++ b/hw/display/bcm2835_fb.c
> @@ -454,7 +454,7 @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_fb;
>  }
>
> -static TypeInfo bcm2835_fb_info = {
> +static const TypeInfo bcm2835_fb_info = {
>      .name          = TYPE_BCM2835_FB,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835FBState),
> diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c
> index 13eb529fc1..146489518c 100644
> --- a/hw/display/i2c-ddc.c
> +++ b/hw/display/i2c-ddc.c
> @@ -113,7 +113,7 @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data)
>      isc->send = i2c_ddc_tx;
>  }
>
> -static TypeInfo i2c_ddc_info = {
> +static const TypeInfo i2c_ddc_info = {
>      .name = TYPE_I2CDDC,
>      .parent = TYPE_I2C_SLAVE,
>      .instance_size = sizeof(I2CDDCState),
> diff --git a/hw/display/macfb.c b/hw/display/macfb.c
> index 4bd7c3ad6a..69c2ea2b6e 100644
> --- a/hw/display/macfb.c
> +++ b/hw/display/macfb.c
> @@ -783,14 +783,14 @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data)
>      device_class_set_props(dc, macfb_nubus_properties);
>  }
>
> -static TypeInfo macfb_sysbus_info = {
> +static const TypeInfo macfb_sysbus_info = {
>      .name          = TYPE_MACFB,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(MacfbSysBusState),
>      .class_init    = macfb_sysbus_class_init,
>  };
>
> -static TypeInfo macfb_nubus_info = {
> +static const TypeInfo macfb_nubus_info = {
>      .name          = TYPE_NUBUS_MACFB,
>      .parent        = TYPE_NUBUS_DEVICE,
>      .instance_size = sizeof(MacfbNubusState),
> diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
> index b23a75a04b..5a2f7a4540 100644
> --- a/hw/display/virtio-vga.c
> +++ b/hw/display/virtio-vga.c
> @@ -220,7 +220,7 @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data)
>                                     virtio_vga_set_big_endian_fb);
>  }
>
> -static TypeInfo virtio_vga_base_info = {
> +static const TypeInfo virtio_vga_base_info = {
>      .name          = TYPE_VIRTIO_VGA_BASE,
>      .parent        = TYPE_VIRTIO_PCI,
>      .instance_size = sizeof(VirtIOVGABase),
> diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
> index eb0002a2b9..5e9306110d 100644
> --- a/hw/dma/bcm2835_dma.c
> +++ b/hw/dma/bcm2835_dma.c
> @@ -394,7 +394,7 @@ static void bcm2835_dma_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_dma;
>  }
>
> -static TypeInfo bcm2835_dma_info = {
> +static const TypeInfo bcm2835_dma_info = {
>      .name          = TYPE_BCM2835_DMA,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835DMAState),
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7c7790a5ce..f6557d3c21 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -865,7 +865,7 @@ static void isa_bridge_class_init(ObjectClass *klass, void *data)
>      k->class_id     = PCI_CLASS_BRIDGE_ISA;
>  };
>
> -static TypeInfo isa_bridge_info = {
> +static const TypeInfo isa_bridge_info = {
>      .name          = "igd-passthrough-isa-bridge",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
> index 96b2940d75..d664829d35 100644
> --- a/hw/i386/sgx-epc.c
> +++ b/hw/i386/sgx-epc.c
> @@ -167,7 +167,7 @@ static void sgx_epc_class_init(ObjectClass *oc, void *data)
>      mdc->fill_device_info = sgx_epc_md_fill_device_info;
>  }
>
> -static TypeInfo sgx_epc_info = {
> +static const TypeInfo sgx_epc_info = {
>      .name          = TYPE_SGX_EPC,
>      .parent        = TYPE_DEVICE,
>      .instance_size = sizeof(SGXEPCDevice),
> diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
> index 9000d995e8..4513fad16f 100644
> --- a/hw/intc/bcm2835_ic.c
> +++ b/hw/intc/bcm2835_ic.c
> @@ -227,7 +227,7 @@ static void bcm2835_ic_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_ic;
>  }
>
> -static TypeInfo bcm2835_ic_info = {
> +static const TypeInfo bcm2835_ic_info = {
>      .name          = TYPE_BCM2835_IC,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835ICState),
> diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
> index 2ead76ffdc..b0589df188 100644
> --- a/hw/intc/bcm2836_control.c
> +++ b/hw/intc/bcm2836_control.c
> @@ -392,7 +392,7 @@ static void bcm2836_control_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2836_control;
>  }
>
> -static TypeInfo bcm2836_control_info = {
> +static const TypeInfo bcm2836_control_info = {
>      .name          = TYPE_BCM2836_CONTROL,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2836ControlState),
> diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
> index 8d35c9fdd6..bbb07b151e 100644
> --- a/hw/ipmi/ipmi.c
> +++ b/hw/ipmi/ipmi.c
> @@ -85,7 +85,7 @@ static void ipmi_interface_class_init(ObjectClass *class, void *data)
>      ik->do_hw_op = ipmi_do_hw_op;
>  }
>
> -static TypeInfo ipmi_interface_type_info = {
> +static const TypeInfo ipmi_interface_type_info = {
>      .name = TYPE_IPMI_INTERFACE,
>      .parent = TYPE_INTERFACE,
>      .class_size = sizeof(IPMIInterfaceClass),
> @@ -120,7 +120,7 @@ static void bmc_class_init(ObjectClass *oc, void *data)
>      device_class_set_props(dc, ipmi_bmc_properties);
>  }
>
> -static TypeInfo ipmi_bmc_type_info = {
> +static const TypeInfo ipmi_bmc_type_info = {
>      .name = TYPE_IPMI_BMC,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(IPMIBmc),
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index 7397b67156..933bc5e0c7 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -248,7 +248,7 @@ static void nvdimm_class_init(ObjectClass *oc, void *data)
>      set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
>  }
>
> -static TypeInfo nvdimm_info = {
> +static const TypeInfo nvdimm_info = {
>      .name          = TYPE_NVDIMM,
>      .parent        = TYPE_PC_DIMM,
>      .class_size    = sizeof(NVDIMMClass),
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 48b913aba6..28af0d71b2 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -286,7 +286,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void *data)
>      mdc->fill_device_info = pc_dimm_md_fill_device_info;
>  }
>
> -static TypeInfo pc_dimm_info = {
> +static const TypeInfo pc_dimm_info = {
>      .name          = TYPE_PC_DIMM,
>      .parent        = TYPE_DEVICE,
>      .instance_size = sizeof(PCDIMMDevice),
> diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
> index 9f73cbd5e4..1908c152f6 100644
> --- a/hw/misc/bcm2835_mbox.c
> +++ b/hw/misc/bcm2835_mbox.c
> @@ -324,7 +324,7 @@ static void bcm2835_mbox_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_mbox;
>  }
>
> -static TypeInfo bcm2835_mbox_info = {
> +static const TypeInfo bcm2835_mbox_info = {
>      .name          = TYPE_BCM2835_MBOX,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835MboxState),
> diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c
> index 25fa804cbd..976f3d34e5 100644
> --- a/hw/misc/bcm2835_powermgt.c
> +++ b/hw/misc/bcm2835_powermgt.c
> @@ -144,7 +144,7 @@ static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_powermgt;
>  }
>
> -static TypeInfo bcm2835_powermgt_info = {
> +static const TypeInfo bcm2835_powermgt_info = {
>      .name          = TYPE_BCM2835_POWERMGT,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835PowerMgtState),
> diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
> index 76ea511d53..e94e951057 100644
> --- a/hw/misc/bcm2835_property.c
> +++ b/hw/misc/bcm2835_property.c
> @@ -421,7 +421,7 @@ static void bcm2835_property_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_property;
>  }
>
> -static TypeInfo bcm2835_property_info = {
> +static const TypeInfo bcm2835_property_info = {
>      .name          = TYPE_BCM2835_PROPERTY,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835PropertyState),
> diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c
> index d0c4e64e88..b3c80cf186 100644
> --- a/hw/misc/bcm2835_rng.c
> +++ b/hw/misc/bcm2835_rng.c
> @@ -131,7 +131,7 @@ static void bcm2835_rng_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_rng;
>  }
>
> -static TypeInfo bcm2835_rng_info = {
> +static const TypeInfo bcm2835_rng_info = {
>      .name          = TYPE_BCM2835_RNG,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835RngState),
> diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
> index 7b66d58acc..a39fcdd1fc 100644
> --- a/hw/misc/pvpanic-isa.c
> +++ b/hw/misc/pvpanic-isa.c
> @@ -77,7 +77,7 @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo pvpanic_isa_info = {
> +static const TypeInfo pvpanic_isa_info = {
>      .name          = TYPE_PVPANIC_ISA_DEVICE,
>      .parent        = TYPE_ISA_DEVICE,
>      .instance_size = sizeof(PVPanicISAState),
> diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
> index af8cbe2830..62e1be68c1 100644
> --- a/hw/misc/pvpanic-pci.c
> +++ b/hw/misc/pvpanic-pci.c
> @@ -74,7 +74,7 @@ static void pvpanic_pci_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo pvpanic_pci_info = {
> +static const TypeInfo pvpanic_pci_info = {
>      .name          = TYPE_PVPANIC_PCI_DEVICE,
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PVPanicPCIState),
> diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
> index bd9d62b559..e7fc082518 100644
> --- a/hw/net/fsl_etsec/etsec.c
> +++ b/hw/net/fsl_etsec/etsec.c
> @@ -430,7 +430,7 @@ static void etsec_class_init(ObjectClass *klass, void *data)
>      dc->user_creatable = true;
>  }
>
> -static TypeInfo etsec_info = {
> +static const TypeInfo etsec_info = {
>      .name                  = TYPE_ETSEC_COMMON,
>      .parent                = TYPE_SYS_BUS_DEVICE,
>      .instance_size         = sizeof(eTSEC),
> diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
> index b2bd783248..8c9b8dd67b 100644
> --- a/hw/ppc/prep_systemio.c
> +++ b/hw/ppc/prep_systemio.c
> @@ -300,7 +300,7 @@ static void prep_systemio_class_initfn(ObjectClass *klass, void *data)
>      device_class_set_props(dc, prep_systemio_properties);
>  }
>
> -static TypeInfo prep_systemio800_info = {
> +static const TypeInfo prep_systemio800_info = {
>      .name          = TYPE_PREP_SYSTEMIO,
>      .parent        = TYPE_ISA_DEVICE,
>      .instance_size = sizeof(PrepSystemIoState),
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index db01071858..81e5a1aea3 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -685,7 +685,7 @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data)
>      spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce);
>  }
>
> -static TypeInfo spapr_tce_table_info = {
> +static const TypeInfo spapr_tce_table_info = {
>      .name = TYPE_SPAPR_TCE_TABLE,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(SpaprTceTable),
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 01b58ebc70..4b2bdd94b3 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -1392,7 +1392,7 @@ static const TypeInfo s390_pci_device_info = {
>      .class_init = s390_pci_device_class_init,
>  };
>
> -static TypeInfo s390_pci_iommu_info = {
> +static const TypeInfo s390_pci_iommu_info = {
>      .name = TYPE_S390_PCI_IOMMU,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(S390PCIIOMMU),
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index 89c30a8a91..eff74479f4 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -460,7 +460,7 @@ static void sclp_class_init(ObjectClass *oc, void *data)
>      sc->service_interrupt = service_interrupt;
>  }
>
> -static TypeInfo sclp_info = {
> +static const TypeInfo sclp_info = {
>      .name = TYPE_SCLP,
>      .parent = TYPE_DEVICE,
>      .instance_init = sclp_init,
> diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
> index ec855811ae..9d0cbfbce2 100644
> --- a/hw/s390x/tod-kvm.c
> +++ b/hw/s390x/tod-kvm.c
> @@ -147,7 +147,7 @@ static void kvm_s390_tod_init(Object *obj)
>      td->stopped = false;
>  }
>
> -static TypeInfo kvm_s390_tod_info = {
> +static const TypeInfo kvm_s390_tod_info = {
>      .name = TYPE_KVM_S390_TOD,
>      .parent = TYPE_S390_TOD,
>      .instance_size = sizeof(S390TODState),
> diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c
> index 9bb94ff72b..ad4993203d 100644
> --- a/hw/s390x/tod-tcg.c
> +++ b/hw/s390x/tod-tcg.c
> @@ -73,7 +73,7 @@ static void qemu_s390_tod_init(Object *obj)
>      }
>  }
>
> -static TypeInfo qemu_s390_tod_info = {
> +static const TypeInfo qemu_s390_tod_info = {
>      .name = TYPE_QEMU_S390_TOD,
>      .parent = TYPE_S390_TOD,
>      .instance_size = sizeof(S390TODState),
> diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c
> index fd5a36bf24..c81b1c0338 100644
> --- a/hw/s390x/tod.c
> +++ b/hw/s390x/tod.c
> @@ -123,7 +123,7 @@ static void s390_tod_class_init(ObjectClass *oc, void *data)
>      dc->user_creatable = false;
>  }
>
> -static TypeInfo s390_tod_info = {
> +static const TypeInfo s390_tod_info = {
>      .name = TYPE_S390_TOD,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(S390TODState),
> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
> index 4c431adb77..c8773f73f7 100644
> --- a/hw/scsi/lsi53c895a.c
> +++ b/hw/scsi/lsi53c895a.c
> @@ -2352,7 +2352,7 @@ static void lsi53c810_class_init(ObjectClass *klass, void *data)
>      k->device_id = PCI_DEVICE_ID_LSI_53C810;
>  }
>
> -static TypeInfo lsi53c810_info = {
> +static const TypeInfo lsi53c810_info = {
>      .name          = TYPE_LSI53C810,
>      .parent        = TYPE_LSI53C895A,
>      .class_init    = lsi53c810_class_init,
> diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
> index de5bc49e68..041e45c680 100644
> --- a/hw/sd/allwinner-sdhost.c
> +++ b/hw/sd/allwinner-sdhost.c
> @@ -835,7 +835,7 @@ static void allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data)
>      sc->max_desc_size = 64 * KiB;
>  }
>
> -static TypeInfo allwinner_sdhost_info = {
> +static const TypeInfo allwinner_sdhost_info = {
>      .name          = TYPE_AW_SDHOST,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_init = allwinner_sdhost_init,
> diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
> index df1bdf1fa4..be8cafd65f 100644
> --- a/hw/sd/aspeed_sdhci.c
> +++ b/hw/sd/aspeed_sdhci.c
> @@ -198,7 +198,7 @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data)
>      device_class_set_props(dc, aspeed_sdhci_properties);
>  }
>
> -static TypeInfo aspeed_sdhci_info = {
> +static const TypeInfo aspeed_sdhci_info = {
>      .name          = TYPE_ASPEED_SDHCI,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(AspeedSDHCIState),
> diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
> index 088a7ac6ed..9431c35914 100644
> --- a/hw/sd/bcm2835_sdhost.c
> +++ b/hw/sd/bcm2835_sdhost.c
> @@ -436,7 +436,7 @@ static void bcm2835_sdhost_class_init(ObjectClass *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_sdhost;
>  }
>
> -static TypeInfo bcm2835_sdhost_info = {
> +static const TypeInfo bcm2835_sdhost_info = {
>      .name          = TYPE_BCM2835_SDHOST,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835SDHostState),
> diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c
> index 56b8bae1c3..75db34befe 100644
> --- a/hw/sd/cadence_sdhci.c
> +++ b/hw/sd/cadence_sdhci.c
> @@ -175,7 +175,7 @@ static void cadence_sdhci_class_init(ObjectClass *classp, void *data)
>      dc->vmsd = &vmstate_cadence_sdhci;
>  }
>
> -static TypeInfo cadence_sdhci_info = {
> +static const TypeInfo cadence_sdhci_info = {
>      .name          = TYPE_CADENCE_SDHCI,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(CadenceSDHCIState),
> diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c
> index ef503365df..b2f5b4a542 100644
> --- a/hw/sd/npcm7xx_sdhci.c
> +++ b/hw/sd/npcm7xx_sdhci.c
> @@ -166,7 +166,7 @@ static void npcm7xx_sdhci_instance_init(Object *obj)
>                              TYPE_SYSBUS_SDHCI);
>  }
>
> -static TypeInfo npcm7xx_sdhci_info = {
> +static const TypeInfo npcm7xx_sdhci_info = {
>      .name = TYPE_NPCM7XX_SDHCI,
>      .parent = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(NPCM7xxSDHCIState),
> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
> index c1d1694fd0..1e6ac76bef 100644
> --- a/hw/usb/dev-mtp.c
> +++ b/hw/usb/dev-mtp.c
> @@ -2106,7 +2106,7 @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data)
>      device_class_set_props(dc, mtp_properties);
>  }
>
> -static TypeInfo mtp_info = {
> +static const TypeInfo mtp_info = {
>      .name          = TYPE_USB_MTP,
>      .parent        = TYPE_USB_DEVICE,
>      .instance_size = sizeof(MTPState),
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index d0d46dd0a4..2b35cb6cdd 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -1801,7 +1801,7 @@ static void usb_host_class_initfn(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
>  }
>
> -static TypeInfo usb_host_dev_info = {
> +static const TypeInfo usb_host_dev_info = {
>      .name          = TYPE_USB_HOST_DEVICE,
>      .parent        = TYPE_USB_DEVICE,
>      .instance_size = sizeof(USBHostDevice),
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index d4685709a3..afe3fe7efc 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -199,7 +199,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data)
>      k->class_id = PCI_CLASS_BRIDGE_ISA;
>  }
>
> -static TypeInfo vfio_pci_igd_lpc_bridge_info = {
> +static const TypeInfo vfio_pci_igd_lpc_bridge_info = {
>      .name = "vfio-pci-igd-lpc-bridge",
>      .parent = TYPE_PCI_DEVICE,
>      .class_init = vfio_pci_igd_lpc_bridge_class_init,
> diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
> index d1aeb90a31..5419dca75e 100644
> --- a/hw/virtio/virtio-pmem.c
> +++ b/hw/virtio/virtio-pmem.c
> @@ -182,7 +182,7 @@ static void virtio_pmem_class_init(ObjectClass *klass, void *data)
>      set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
>  }
>
> -static TypeInfo virtio_pmem_info = {
> +static const TypeInfo virtio_pmem_info = {
>      .name          = TYPE_VIRTIO_PMEM,
>      .parent        = TYPE_VIRTIO_DEVICE,
>      .class_size    = sizeof(VirtIOPMEMClass),
> diff --git a/qom/object.c b/qom/object.c
> index 4f0677cca9..9f7a33139d 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -2793,13 +2793,13 @@ static void object_class_init(ObjectClass *klass, void *data)
>
>  static void register_types(void)
>  {
> -    static TypeInfo interface_info = {
> +    static const TypeInfo interface_info = {
>          .name = TYPE_INTERFACE,
>          .class_size = sizeof(InterfaceClass),
>          .abstract = true,
>      };
>
> -    static TypeInfo object_info = {
> +    static const TypeInfo object_info = {
>          .name = TYPE_OBJECT,
>          .instance_size = sizeof(Object),
>          .class_init = object_class_init,
> --
> 2.34.1
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark remaining global TypeInfo instances as const
  2022-01-13 17:10 [PATCH] Mark remaining global TypeInfo instances as const Bernhard Beschow
  2022-01-13 22:11 ` Alistair Francis
@ 2022-01-14  6:59 ` Thomas Huth
  2022-01-14 11:02 ` Philippe Mathieu-Daudé via
  2022-01-17 15:08 ` Bernhard Beschow
  3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2022-01-14  6:59 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: Fam Zheng, Peter Maydell, Matthew Rosato, Michael S. Tsirkin,
	Jason Wang, David Hildenbrand, Laurent Vivier, Gerd Hoffmann,
	Ani Sinha, Edgar E. Iglesias, qemu-trivial,
	Daniel Henrique Barboza, Havard Skinnemoen, Halil Pasic,
	Hervé Poussineau, Joel Stanley, Christian Borntraeger,
	Eric Farman, Corey Minyard, open list:S390 PCI, Alistair Francis,
	Richard Henderson, Greg Kurz, Beniamino Galvani, Alex Williamson,
	open list:Raspberry Pi, Cédric Le Goater, Paolo Bonzini,
	Alex Bennée, David Gibson, Eduardo Habkost,
	Daniel P. Berrangé,
	Xiao Guangrong, Andrew Jeffery, Cornelia Huck,
	Philippe Mathieu-Daudé,
	Andrew Baumann, Tyrone Ting, open list:e500, Igor Mammedov

On 13/01/2022 18.10, Bernhard Beschow wrote:
> More than 1k of TypeInfo instances are already marked as const. Mark the
> remaining ones, too.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/core/generic-loader.c   | 2 +-
>   hw/core/guest-loader.c     | 2 +-
>   hw/display/bcm2835_fb.c    | 2 +-
>   hw/display/i2c-ddc.c       | 2 +-
>   hw/display/macfb.c         | 4 ++--
>   hw/display/virtio-vga.c    | 2 +-
>   hw/dma/bcm2835_dma.c       | 2 +-
>   hw/i386/pc_piix.c          | 2 +-
>   hw/i386/sgx-epc.c          | 2 +-
>   hw/intc/bcm2835_ic.c       | 2 +-
>   hw/intc/bcm2836_control.c  | 2 +-
>   hw/ipmi/ipmi.c             | 4 ++--
>   hw/mem/nvdimm.c            | 2 +-
>   hw/mem/pc-dimm.c           | 2 +-
>   hw/misc/bcm2835_mbox.c     | 2 +-
>   hw/misc/bcm2835_powermgt.c | 2 +-
>   hw/misc/bcm2835_property.c | 2 +-
>   hw/misc/bcm2835_rng.c      | 2 +-
>   hw/misc/pvpanic-isa.c      | 2 +-
>   hw/misc/pvpanic-pci.c      | 2 +-
>   hw/net/fsl_etsec/etsec.c   | 2 +-
>   hw/ppc/prep_systemio.c     | 2 +-
>   hw/ppc/spapr_iommu.c       | 2 +-
>   hw/s390x/s390-pci-bus.c    | 2 +-
>   hw/s390x/sclp.c            | 2 +-
>   hw/s390x/tod-kvm.c         | 2 +-
>   hw/s390x/tod-tcg.c         | 2 +-
>   hw/s390x/tod.c             | 2 +-
>   hw/scsi/lsi53c895a.c       | 2 +-
>   hw/sd/allwinner-sdhost.c   | 2 +-
>   hw/sd/aspeed_sdhci.c       | 2 +-
>   hw/sd/bcm2835_sdhost.c     | 2 +-
>   hw/sd/cadence_sdhci.c      | 2 +-
>   hw/sd/npcm7xx_sdhci.c      | 2 +-
>   hw/usb/dev-mtp.c           | 2 +-
>   hw/usb/host-libusb.c       | 2 +-
>   hw/vfio/igd.c              | 2 +-
>   hw/virtio/virtio-pmem.c    | 2 +-
>   qom/object.c               | 4 ++--
>   39 files changed, 42 insertions(+), 42 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark remaining global TypeInfo instances as const
  2022-01-13 17:10 [PATCH] Mark remaining global TypeInfo instances as const Bernhard Beschow
  2022-01-13 22:11 ` Alistair Francis
  2022-01-14  6:59 ` Thomas Huth
@ 2022-01-14 11:02 ` Philippe Mathieu-Daudé via
  2022-01-17 15:08 ` Bernhard Beschow
  3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé via @ 2022-01-14 11:02 UTC (permalink / raw)
  To: Bernhard Beschow, qemu-devel
  Cc: qemu-trivial, Alistair Francis, Alex Bennée, Peter Maydell,
	Andrew Baumann, Laurent Vivier, Michael S. Tsirkin,
	Gerd Hoffmann, Paolo Bonzini, Richard Henderson, Eduardo Habkost,
	Marcel Apfelbaum, Corey Minyard, Xiao Guangrong, Igor Mammedov,
	Ani Sinha, Jason Wang, Hervé Poussineau,
	Cédric Le Goater, Daniel Henrique Barboza, David Gibson,
	Greg Kurz, Matthew Rosato, Eric Farman, David Hildenbrand,
	Cornelia Huck, Thomas Huth, Halil Pasic, Christian Borntraeger,
	Fam Zheng, Beniamino Galvani, Andrew Jeffery, Joel Stanley,
	Edgar E. Iglesias, Havard Skinnemoen, Tyrone Ting,
	Alex Williamson, Daniel P. Berrangé,
	open list:Raspberry Pi, open list:e500, open list:S390 PCI

On 13/1/22 18:10, Bernhard Beschow wrote:
> More than 1k of TypeInfo instances are already marked as const. Mark the
> remaining ones, too.
> 
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>   hw/core/generic-loader.c   | 2 +-
>   hw/core/guest-loader.c     | 2 +-
>   hw/display/bcm2835_fb.c    | 2 +-
>   hw/display/i2c-ddc.c       | 2 +-
>   hw/display/macfb.c         | 4 ++--
>   hw/display/virtio-vga.c    | 2 +-
>   hw/dma/bcm2835_dma.c       | 2 +-
>   hw/i386/pc_piix.c          | 2 +-
>   hw/i386/sgx-epc.c          | 2 +-
>   hw/intc/bcm2835_ic.c       | 2 +-
>   hw/intc/bcm2836_control.c  | 2 +-
>   hw/ipmi/ipmi.c             | 4 ++--
>   hw/mem/nvdimm.c            | 2 +-
>   hw/mem/pc-dimm.c           | 2 +-
>   hw/misc/bcm2835_mbox.c     | 2 +-
>   hw/misc/bcm2835_powermgt.c | 2 +-
>   hw/misc/bcm2835_property.c | 2 +-
>   hw/misc/bcm2835_rng.c      | 2 +-
>   hw/misc/pvpanic-isa.c      | 2 +-
>   hw/misc/pvpanic-pci.c      | 2 +-
>   hw/net/fsl_etsec/etsec.c   | 2 +-
>   hw/ppc/prep_systemio.c     | 2 +-
>   hw/ppc/spapr_iommu.c       | 2 +-
>   hw/s390x/s390-pci-bus.c    | 2 +-
>   hw/s390x/sclp.c            | 2 +-
>   hw/s390x/tod-kvm.c         | 2 +-
>   hw/s390x/tod-tcg.c         | 2 +-
>   hw/s390x/tod.c             | 2 +-
>   hw/scsi/lsi53c895a.c       | 2 +-
>   hw/sd/allwinner-sdhost.c   | 2 +-
>   hw/sd/aspeed_sdhci.c       | 2 +-
>   hw/sd/bcm2835_sdhost.c     | 2 +-
>   hw/sd/cadence_sdhci.c      | 2 +-
>   hw/sd/npcm7xx_sdhci.c      | 2 +-
>   hw/usb/dev-mtp.c           | 2 +-
>   hw/usb/host-libusb.c       | 2 +-
>   hw/vfio/igd.c              | 2 +-
>   hw/virtio/virtio-pmem.c    | 2 +-
>   qom/object.c               | 4 ++--
>   39 files changed, 42 insertions(+), 42 deletions(-)
> 
> diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
> index 9a24ffb880..eaafc416f4 100644
> --- a/hw/core/generic-loader.c
> +++ b/hw/core/generic-loader.c
> @@ -207,7 +207,7 @@ static void generic_loader_class_init(ObjectClass *klass, void *data)
>       set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>   }
>   
> -static TypeInfo generic_loader_info = {
> +static const TypeInfo generic_loader_info = {

Good cleanup. If you use a sed expression to automatically replace,
it would be nice to mention it (see i.e. commit f548f20176cb5f4406).

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

To avoid further non-const static TypeInfo introduced, we should
add a check in scripts/checkpatch.pl. Maybe a simple "static TypeInfo"
line comparison is enough. Do you mind having a look for a patch?

Thanks,

Phil.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Mark remaining global TypeInfo instances as const
  2022-01-13 17:10 [PATCH] Mark remaining global TypeInfo instances as const Bernhard Beschow
                   ` (2 preceding siblings ...)
  2022-01-14 11:02 ` Philippe Mathieu-Daudé via
@ 2022-01-17 15:08 ` Bernhard Beschow
  3 siblings, 0 replies; 5+ messages in thread
From: Bernhard Beschow @ 2022-01-17 15:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Fam Zheng, Peter Maydell, Matthew Rosato, Michael S. Tsirkin,
	Jason Wang, David Hildenbrand, qemu-devel, Gerd Hoffmann,
	Ani Sinha, Edgar E. Iglesias, qemu-trivial,
	Daniel Henrique Barboza, Havard Skinnemoen, Halil Pasic,
	Hervé Poussineau, Joel Stanley, Thomas Huth,
	Christian Borntraeger, Eric Farman, Corey Minyard,
	open list:S390 PCI, Alistair Francis, Richard Henderson,
	Greg Kurz, Beniamino Galvani, Alex Williamson,
	open list:Raspberry Pi, Cédric Le Goater, Paolo Bonzini,
	Alex Bennée, David Gibson, Eduardo Habkost,
	Daniel P. Berrangé,
	Xiao Guangrong, Andrew Jeffery, Cornelia Huck, Laurent Vivier,
	Andrew Baumann, Tyrone Ting, open list:e500, Igor Mammedov

[-- Attachment #1: Type: text/plain, Size: 22827 bytes --]

Hi Philippe,

Thanks for your review. I've now sent v2 of the patch with your comments
addressed.

BTW: I almost missed your review because apparently I wasn't in the CC.
That is also the reason I'm not responding to your mail directly.

Bernhard.

On Thu, Jan 13, 2022 at 6:10 PM Bernhard Beschow <shentey@gmail.com> wrote:

> More than 1k of TypeInfo instances are already marked as const. Mark the
> remaining ones, too.
>
> Signed-off-by: Bernhard Beschow <shentey@gmail.com>
> ---
>  hw/core/generic-loader.c   | 2 +-
>  hw/core/guest-loader.c     | 2 +-
>  hw/display/bcm2835_fb.c    | 2 +-
>  hw/display/i2c-ddc.c       | 2 +-
>  hw/display/macfb.c         | 4 ++--
>  hw/display/virtio-vga.c    | 2 +-
>  hw/dma/bcm2835_dma.c       | 2 +-
>  hw/i386/pc_piix.c          | 2 +-
>  hw/i386/sgx-epc.c          | 2 +-
>  hw/intc/bcm2835_ic.c       | 2 +-
>  hw/intc/bcm2836_control.c  | 2 +-
>  hw/ipmi/ipmi.c             | 4 ++--
>  hw/mem/nvdimm.c            | 2 +-
>  hw/mem/pc-dimm.c           | 2 +-
>  hw/misc/bcm2835_mbox.c     | 2 +-
>  hw/misc/bcm2835_powermgt.c | 2 +-
>  hw/misc/bcm2835_property.c | 2 +-
>  hw/misc/bcm2835_rng.c      | 2 +-
>  hw/misc/pvpanic-isa.c      | 2 +-
>  hw/misc/pvpanic-pci.c      | 2 +-
>  hw/net/fsl_etsec/etsec.c   | 2 +-
>  hw/ppc/prep_systemio.c     | 2 +-
>  hw/ppc/spapr_iommu.c       | 2 +-
>  hw/s390x/s390-pci-bus.c    | 2 +-
>  hw/s390x/sclp.c            | 2 +-
>  hw/s390x/tod-kvm.c         | 2 +-
>  hw/s390x/tod-tcg.c         | 2 +-
>  hw/s390x/tod.c             | 2 +-
>  hw/scsi/lsi53c895a.c       | 2 +-
>  hw/sd/allwinner-sdhost.c   | 2 +-
>  hw/sd/aspeed_sdhci.c       | 2 +-
>  hw/sd/bcm2835_sdhost.c     | 2 +-
>  hw/sd/cadence_sdhci.c      | 2 +-
>  hw/sd/npcm7xx_sdhci.c      | 2 +-
>  hw/usb/dev-mtp.c           | 2 +-
>  hw/usb/host-libusb.c       | 2 +-
>  hw/vfio/igd.c              | 2 +-
>  hw/virtio/virtio-pmem.c    | 2 +-
>  qom/object.c               | 4 ++--
>  39 files changed, 42 insertions(+), 42 deletions(-)
>
> diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c
> index 9a24ffb880..eaafc416f4 100644
> --- a/hw/core/generic-loader.c
> +++ b/hw/core/generic-loader.c
> @@ -207,7 +207,7 @@ static void generic_loader_class_init(ObjectClass
> *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo generic_loader_info = {
> +static const TypeInfo generic_loader_info = {
>      .name = TYPE_GENERIC_LOADER,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(GenericLoaderState),
> diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c
> index d3f9d1a06e..391c875a29 100644
> --- a/hw/core/guest-loader.c
> +++ b/hw/core/guest-loader.c
> @@ -129,7 +129,7 @@ static void guest_loader_class_init(ObjectClass
> *klass, void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo guest_loader_info = {
> +static const TypeInfo guest_loader_info = {
>      .name = TYPE_GUEST_LOADER,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(GuestLoaderState),
> diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c
> index 2be77bdd3a..088fc3d51c 100644
> --- a/hw/display/bcm2835_fb.c
> +++ b/hw/display/bcm2835_fb.c
> @@ -454,7 +454,7 @@ static void bcm2835_fb_class_init(ObjectClass *klass,
> void *data)
>      dc->vmsd = &vmstate_bcm2835_fb;
>  }
>
> -static TypeInfo bcm2835_fb_info = {
> +static const TypeInfo bcm2835_fb_info = {
>      .name          = TYPE_BCM2835_FB,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835FBState),
> diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c
> index 13eb529fc1..146489518c 100644
> --- a/hw/display/i2c-ddc.c
> +++ b/hw/display/i2c-ddc.c
> @@ -113,7 +113,7 @@ static void i2c_ddc_class_init(ObjectClass *oc, void
> *data)
>      isc->send = i2c_ddc_tx;
>  }
>
> -static TypeInfo i2c_ddc_info = {
> +static const TypeInfo i2c_ddc_info = {
>      .name = TYPE_I2CDDC,
>      .parent = TYPE_I2C_SLAVE,
>      .instance_size = sizeof(I2CDDCState),
> diff --git a/hw/display/macfb.c b/hw/display/macfb.c
> index 4bd7c3ad6a..69c2ea2b6e 100644
> --- a/hw/display/macfb.c
> +++ b/hw/display/macfb.c
> @@ -783,14 +783,14 @@ static void macfb_nubus_class_init(ObjectClass
> *klass, void *data)
>      device_class_set_props(dc, macfb_nubus_properties);
>  }
>
> -static TypeInfo macfb_sysbus_info = {
> +static const TypeInfo macfb_sysbus_info = {
>      .name          = TYPE_MACFB,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(MacfbSysBusState),
>      .class_init    = macfb_sysbus_class_init,
>  };
>
> -static TypeInfo macfb_nubus_info = {
> +static const TypeInfo macfb_nubus_info = {
>      .name          = TYPE_NUBUS_MACFB,
>      .parent        = TYPE_NUBUS_DEVICE,
>      .instance_size = sizeof(MacfbNubusState),
> diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c
> index b23a75a04b..5a2f7a4540 100644
> --- a/hw/display/virtio-vga.c
> +++ b/hw/display/virtio-vga.c
> @@ -220,7 +220,7 @@ static void virtio_vga_base_class_init(ObjectClass
> *klass, void *data)
>                                     virtio_vga_set_big_endian_fb);
>  }
>
> -static TypeInfo virtio_vga_base_info = {
> +static const TypeInfo virtio_vga_base_info = {
>      .name          = TYPE_VIRTIO_VGA_BASE,
>      .parent        = TYPE_VIRTIO_PCI,
>      .instance_size = sizeof(VirtIOVGABase),
> diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c
> index eb0002a2b9..5e9306110d 100644
> --- a/hw/dma/bcm2835_dma.c
> +++ b/hw/dma/bcm2835_dma.c
> @@ -394,7 +394,7 @@ static void bcm2835_dma_class_init(ObjectClass *klass,
> void *data)
>      dc->vmsd = &vmstate_bcm2835_dma;
>  }
>
> -static TypeInfo bcm2835_dma_info = {
> +static const TypeInfo bcm2835_dma_info = {
>      .name          = TYPE_BCM2835_DMA,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835DMAState),
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 7c7790a5ce..f6557d3c21 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -865,7 +865,7 @@ static void isa_bridge_class_init(ObjectClass *klass,
> void *data)
>      k->class_id     = PCI_CLASS_BRIDGE_ISA;
>  };
>
> -static TypeInfo isa_bridge_info = {
> +static const TypeInfo isa_bridge_info = {
>      .name          = "igd-passthrough-isa-bridge",
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PCIDevice),
> diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c
> index 96b2940d75..d664829d35 100644
> --- a/hw/i386/sgx-epc.c
> +++ b/hw/i386/sgx-epc.c
> @@ -167,7 +167,7 @@ static void sgx_epc_class_init(ObjectClass *oc, void
> *data)
>      mdc->fill_device_info = sgx_epc_md_fill_device_info;
>  }
>
> -static TypeInfo sgx_epc_info = {
> +static const TypeInfo sgx_epc_info = {
>      .name          = TYPE_SGX_EPC,
>      .parent        = TYPE_DEVICE,
>      .instance_size = sizeof(SGXEPCDevice),
> diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c
> index 9000d995e8..4513fad16f 100644
> --- a/hw/intc/bcm2835_ic.c
> +++ b/hw/intc/bcm2835_ic.c
> @@ -227,7 +227,7 @@ static void bcm2835_ic_class_init(ObjectClass *klass,
> void *data)
>      dc->vmsd = &vmstate_bcm2835_ic;
>  }
>
> -static TypeInfo bcm2835_ic_info = {
> +static const TypeInfo bcm2835_ic_info = {
>      .name          = TYPE_BCM2835_IC,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835ICState),
> diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c
> index 2ead76ffdc..b0589df188 100644
> --- a/hw/intc/bcm2836_control.c
> +++ b/hw/intc/bcm2836_control.c
> @@ -392,7 +392,7 @@ static void bcm2836_control_class_init(ObjectClass
> *klass, void *data)
>      dc->vmsd = &vmstate_bcm2836_control;
>  }
>
> -static TypeInfo bcm2836_control_info = {
> +static const TypeInfo bcm2836_control_info = {
>      .name          = TYPE_BCM2836_CONTROL,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2836ControlState),
> diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c
> index 8d35c9fdd6..bbb07b151e 100644
> --- a/hw/ipmi/ipmi.c
> +++ b/hw/ipmi/ipmi.c
> @@ -85,7 +85,7 @@ static void ipmi_interface_class_init(ObjectClass
> *class, void *data)
>      ik->do_hw_op = ipmi_do_hw_op;
>  }
>
> -static TypeInfo ipmi_interface_type_info = {
> +static const TypeInfo ipmi_interface_type_info = {
>      .name = TYPE_IPMI_INTERFACE,
>      .parent = TYPE_INTERFACE,
>      .class_size = sizeof(IPMIInterfaceClass),
> @@ -120,7 +120,7 @@ static void bmc_class_init(ObjectClass *oc, void *data)
>      device_class_set_props(dc, ipmi_bmc_properties);
>  }
>
> -static TypeInfo ipmi_bmc_type_info = {
> +static const TypeInfo ipmi_bmc_type_info = {
>      .name = TYPE_IPMI_BMC,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(IPMIBmc),
> diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
> index 7397b67156..933bc5e0c7 100644
> --- a/hw/mem/nvdimm.c
> +++ b/hw/mem/nvdimm.c
> @@ -248,7 +248,7 @@ static void nvdimm_class_init(ObjectClass *oc, void
> *data)
>      set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
>  }
>
> -static TypeInfo nvdimm_info = {
> +static const TypeInfo nvdimm_info = {
>      .name          = TYPE_NVDIMM,
>      .parent        = TYPE_PC_DIMM,
>      .class_size    = sizeof(NVDIMMClass),
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index 48b913aba6..28af0d71b2 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -286,7 +286,7 @@ static void pc_dimm_class_init(ObjectClass *oc, void
> *data)
>      mdc->fill_device_info = pc_dimm_md_fill_device_info;
>  }
>
> -static TypeInfo pc_dimm_info = {
> +static const TypeInfo pc_dimm_info = {
>      .name          = TYPE_PC_DIMM,
>      .parent        = TYPE_DEVICE,
>      .instance_size = sizeof(PCDIMMDevice),
> diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c
> index 9f73cbd5e4..1908c152f6 100644
> --- a/hw/misc/bcm2835_mbox.c
> +++ b/hw/misc/bcm2835_mbox.c
> @@ -324,7 +324,7 @@ static void bcm2835_mbox_class_init(ObjectClass
> *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_mbox;
>  }
>
> -static TypeInfo bcm2835_mbox_info = {
> +static const TypeInfo bcm2835_mbox_info = {
>      .name          = TYPE_BCM2835_MBOX,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835MboxState),
> diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c
> index 25fa804cbd..976f3d34e5 100644
> --- a/hw/misc/bcm2835_powermgt.c
> +++ b/hw/misc/bcm2835_powermgt.c
> @@ -144,7 +144,7 @@ static void bcm2835_powermgt_class_init(ObjectClass
> *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_powermgt;
>  }
>
> -static TypeInfo bcm2835_powermgt_info = {
> +static const TypeInfo bcm2835_powermgt_info = {
>      .name          = TYPE_BCM2835_POWERMGT,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835PowerMgtState),
> diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
> index 76ea511d53..e94e951057 100644
> --- a/hw/misc/bcm2835_property.c
> +++ b/hw/misc/bcm2835_property.c
> @@ -421,7 +421,7 @@ static void bcm2835_property_class_init(ObjectClass
> *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_property;
>  }
>
> -static TypeInfo bcm2835_property_info = {
> +static const TypeInfo bcm2835_property_info = {
>      .name          = TYPE_BCM2835_PROPERTY,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835PropertyState),
> diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c
> index d0c4e64e88..b3c80cf186 100644
> --- a/hw/misc/bcm2835_rng.c
> +++ b/hw/misc/bcm2835_rng.c
> @@ -131,7 +131,7 @@ static void bcm2835_rng_class_init(ObjectClass *klass,
> void *data)
>      dc->vmsd = &vmstate_bcm2835_rng;
>  }
>
> -static TypeInfo bcm2835_rng_info = {
> +static const TypeInfo bcm2835_rng_info = {
>      .name          = TYPE_BCM2835_RNG,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835RngState),
> diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c
> index 7b66d58acc..a39fcdd1fc 100644
> --- a/hw/misc/pvpanic-isa.c
> +++ b/hw/misc/pvpanic-isa.c
> @@ -77,7 +77,7 @@ static void pvpanic_isa_class_init(ObjectClass *klass,
> void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo pvpanic_isa_info = {
> +static const TypeInfo pvpanic_isa_info = {
>      .name          = TYPE_PVPANIC_ISA_DEVICE,
>      .parent        = TYPE_ISA_DEVICE,
>      .instance_size = sizeof(PVPanicISAState),
> diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c
> index af8cbe2830..62e1be68c1 100644
> --- a/hw/misc/pvpanic-pci.c
> +++ b/hw/misc/pvpanic-pci.c
> @@ -74,7 +74,7 @@ static void pvpanic_pci_class_init(ObjectClass *klass,
> void *data)
>      set_bit(DEVICE_CATEGORY_MISC, dc->categories);
>  }
>
> -static TypeInfo pvpanic_pci_info = {
> +static const TypeInfo pvpanic_pci_info = {
>      .name          = TYPE_PVPANIC_PCI_DEVICE,
>      .parent        = TYPE_PCI_DEVICE,
>      .instance_size = sizeof(PVPanicPCIState),
> diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
> index bd9d62b559..e7fc082518 100644
> --- a/hw/net/fsl_etsec/etsec.c
> +++ b/hw/net/fsl_etsec/etsec.c
> @@ -430,7 +430,7 @@ static void etsec_class_init(ObjectClass *klass, void
> *data)
>      dc->user_creatable = true;
>  }
>
> -static TypeInfo etsec_info = {
> +static const TypeInfo etsec_info = {
>      .name                  = TYPE_ETSEC_COMMON,
>      .parent                = TYPE_SYS_BUS_DEVICE,
>      .instance_size         = sizeof(eTSEC),
> diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c
> index b2bd783248..8c9b8dd67b 100644
> --- a/hw/ppc/prep_systemio.c
> +++ b/hw/ppc/prep_systemio.c
> @@ -300,7 +300,7 @@ static void prep_systemio_class_initfn(ObjectClass
> *klass, void *data)
>      device_class_set_props(dc, prep_systemio_properties);
>  }
>
> -static TypeInfo prep_systemio800_info = {
> +static const TypeInfo prep_systemio800_info = {
>      .name          = TYPE_PREP_SYSTEMIO,
>      .parent        = TYPE_ISA_DEVICE,
>      .instance_size = sizeof(PrepSystemIoState),
> diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c
> index db01071858..81e5a1aea3 100644
> --- a/hw/ppc/spapr_iommu.c
> +++ b/hw/ppc/spapr_iommu.c
> @@ -685,7 +685,7 @@ static void spapr_tce_table_class_init(ObjectClass
> *klass, void *data)
>      spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce);
>  }
>
> -static TypeInfo spapr_tce_table_info = {
> +static const TypeInfo spapr_tce_table_info = {
>      .name = TYPE_SPAPR_TCE_TABLE,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(SpaprTceTable),
> diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c
> index 01b58ebc70..4b2bdd94b3 100644
> --- a/hw/s390x/s390-pci-bus.c
> +++ b/hw/s390x/s390-pci-bus.c
> @@ -1392,7 +1392,7 @@ static const TypeInfo s390_pci_device_info = {
>      .class_init = s390_pci_device_class_init,
>  };
>
> -static TypeInfo s390_pci_iommu_info = {
> +static const TypeInfo s390_pci_iommu_info = {
>      .name = TYPE_S390_PCI_IOMMU,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(S390PCIIOMMU),
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index 89c30a8a91..eff74479f4 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -460,7 +460,7 @@ static void sclp_class_init(ObjectClass *oc, void
> *data)
>      sc->service_interrupt = service_interrupt;
>  }
>
> -static TypeInfo sclp_info = {
> +static const TypeInfo sclp_info = {
>      .name = TYPE_SCLP,
>      .parent = TYPE_DEVICE,
>      .instance_init = sclp_init,
> diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
> index ec855811ae..9d0cbfbce2 100644
> --- a/hw/s390x/tod-kvm.c
> +++ b/hw/s390x/tod-kvm.c
> @@ -147,7 +147,7 @@ static void kvm_s390_tod_init(Object *obj)
>      td->stopped = false;
>  }
>
> -static TypeInfo kvm_s390_tod_info = {
> +static const TypeInfo kvm_s390_tod_info = {
>      .name = TYPE_KVM_S390_TOD,
>      .parent = TYPE_S390_TOD,
>      .instance_size = sizeof(S390TODState),
> diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c
> index 9bb94ff72b..ad4993203d 100644
> --- a/hw/s390x/tod-tcg.c
> +++ b/hw/s390x/tod-tcg.c
> @@ -73,7 +73,7 @@ static void qemu_s390_tod_init(Object *obj)
>      }
>  }
>
> -static TypeInfo qemu_s390_tod_info = {
> +static const TypeInfo qemu_s390_tod_info = {
>      .name = TYPE_QEMU_S390_TOD,
>      .parent = TYPE_S390_TOD,
>      .instance_size = sizeof(S390TODState),
> diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c
> index fd5a36bf24..c81b1c0338 100644
> --- a/hw/s390x/tod.c
> +++ b/hw/s390x/tod.c
> @@ -123,7 +123,7 @@ static void s390_tod_class_init(ObjectClass *oc, void
> *data)
>      dc->user_creatable = false;
>  }
>
> -static TypeInfo s390_tod_info = {
> +static const TypeInfo s390_tod_info = {
>      .name = TYPE_S390_TOD,
>      .parent = TYPE_DEVICE,
>      .instance_size = sizeof(S390TODState),
> diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
> index 4c431adb77..c8773f73f7 100644
> --- a/hw/scsi/lsi53c895a.c
> +++ b/hw/scsi/lsi53c895a.c
> @@ -2352,7 +2352,7 @@ static void lsi53c810_class_init(ObjectClass *klass,
> void *data)
>      k->device_id = PCI_DEVICE_ID_LSI_53C810;
>  }
>
> -static TypeInfo lsi53c810_info = {
> +static const TypeInfo lsi53c810_info = {
>      .name          = TYPE_LSI53C810,
>      .parent        = TYPE_LSI53C895A,
>      .class_init    = lsi53c810_class_init,
> diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c
> index de5bc49e68..041e45c680 100644
> --- a/hw/sd/allwinner-sdhost.c
> +++ b/hw/sd/allwinner-sdhost.c
> @@ -835,7 +835,7 @@ static void
> allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data)
>      sc->max_desc_size = 64 * KiB;
>  }
>
> -static TypeInfo allwinner_sdhost_info = {
> +static const TypeInfo allwinner_sdhost_info = {
>      .name          = TYPE_AW_SDHOST,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_init = allwinner_sdhost_init,
> diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c
> index df1bdf1fa4..be8cafd65f 100644
> --- a/hw/sd/aspeed_sdhci.c
> +++ b/hw/sd/aspeed_sdhci.c
> @@ -198,7 +198,7 @@ static void aspeed_sdhci_class_init(ObjectClass
> *classp, void *data)
>      device_class_set_props(dc, aspeed_sdhci_properties);
>  }
>
> -static TypeInfo aspeed_sdhci_info = {
> +static const TypeInfo aspeed_sdhci_info = {
>      .name          = TYPE_ASPEED_SDHCI,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(AspeedSDHCIState),
> diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c
> index 088a7ac6ed..9431c35914 100644
> --- a/hw/sd/bcm2835_sdhost.c
> +++ b/hw/sd/bcm2835_sdhost.c
> @@ -436,7 +436,7 @@ static void bcm2835_sdhost_class_init(ObjectClass
> *klass, void *data)
>      dc->vmsd = &vmstate_bcm2835_sdhost;
>  }
>
> -static TypeInfo bcm2835_sdhost_info = {
> +static const TypeInfo bcm2835_sdhost_info = {
>      .name          = TYPE_BCM2835_SDHOST,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(BCM2835SDHostState),
> diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c
> index 56b8bae1c3..75db34befe 100644
> --- a/hw/sd/cadence_sdhci.c
> +++ b/hw/sd/cadence_sdhci.c
> @@ -175,7 +175,7 @@ static void cadence_sdhci_class_init(ObjectClass
> *classp, void *data)
>      dc->vmsd = &vmstate_cadence_sdhci;
>  }
>
> -static TypeInfo cadence_sdhci_info = {
> +static const TypeInfo cadence_sdhci_info = {
>      .name          = TYPE_CADENCE_SDHCI,
>      .parent        = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(CadenceSDHCIState),
> diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c
> index ef503365df..b2f5b4a542 100644
> --- a/hw/sd/npcm7xx_sdhci.c
> +++ b/hw/sd/npcm7xx_sdhci.c
> @@ -166,7 +166,7 @@ static void npcm7xx_sdhci_instance_init(Object *obj)
>                              TYPE_SYSBUS_SDHCI);
>  }
>
> -static TypeInfo npcm7xx_sdhci_info = {
> +static const TypeInfo npcm7xx_sdhci_info = {
>      .name = TYPE_NPCM7XX_SDHCI,
>      .parent = TYPE_SYS_BUS_DEVICE,
>      .instance_size = sizeof(NPCM7xxSDHCIState),
> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
> index c1d1694fd0..1e6ac76bef 100644
> --- a/hw/usb/dev-mtp.c
> +++ b/hw/usb/dev-mtp.c
> @@ -2106,7 +2106,7 @@ static void usb_mtp_class_initfn(ObjectClass *klass,
> void *data)
>      device_class_set_props(dc, mtp_properties);
>  }
>
> -static TypeInfo mtp_info = {
> +static const TypeInfo mtp_info = {
>      .name          = TYPE_USB_MTP,
>      .parent        = TYPE_USB_DEVICE,
>      .instance_size = sizeof(MTPState),
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index d0d46dd0a4..2b35cb6cdd 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -1801,7 +1801,7 @@ static void usb_host_class_initfn(ObjectClass
> *klass, void *data)
>      set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
>  }
>
> -static TypeInfo usb_host_dev_info = {
> +static const TypeInfo usb_host_dev_info = {
>      .name          = TYPE_USB_HOST_DEVICE,
>      .parent        = TYPE_USB_DEVICE,
>      .instance_size = sizeof(USBHostDevice),
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index d4685709a3..afe3fe7efc 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -199,7 +199,7 @@ static void
> vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data)
>      k->class_id = PCI_CLASS_BRIDGE_ISA;
>  }
>
> -static TypeInfo vfio_pci_igd_lpc_bridge_info = {
> +static const TypeInfo vfio_pci_igd_lpc_bridge_info = {
>      .name = "vfio-pci-igd-lpc-bridge",
>      .parent = TYPE_PCI_DEVICE,
>      .class_init = vfio_pci_igd_lpc_bridge_class_init,
> diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c
> index d1aeb90a31..5419dca75e 100644
> --- a/hw/virtio/virtio-pmem.c
> +++ b/hw/virtio/virtio-pmem.c
> @@ -182,7 +182,7 @@ static void virtio_pmem_class_init(ObjectClass *klass,
> void *data)
>      set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
>  }
>
> -static TypeInfo virtio_pmem_info = {
> +static const TypeInfo virtio_pmem_info = {
>      .name          = TYPE_VIRTIO_PMEM,
>      .parent        = TYPE_VIRTIO_DEVICE,
>      .class_size    = sizeof(VirtIOPMEMClass),
> diff --git a/qom/object.c b/qom/object.c
> index 4f0677cca9..9f7a33139d 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -2793,13 +2793,13 @@ static void object_class_init(ObjectClass *klass,
> void *data)
>
>  static void register_types(void)
>  {
> -    static TypeInfo interface_info = {
> +    static const TypeInfo interface_info = {
>          .name = TYPE_INTERFACE,
>          .class_size = sizeof(InterfaceClass),
>          .abstract = true,
>      };
>
> -    static TypeInfo object_info = {
> +    static const TypeInfo object_info = {
>          .name = TYPE_OBJECT,
>          .instance_size = sizeof(Object),
>          .class_init = object_class_init,
> --
> 2.34.1
>
>

[-- Attachment #2: Type: text/html, Size: 26164 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-17 15:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 17:10 [PATCH] Mark remaining global TypeInfo instances as const Bernhard Beschow
2022-01-13 22:11 ` Alistair Francis
2022-01-14  6:59 ` Thomas Huth
2022-01-14 11:02 ` Philippe Mathieu-Daudé via
2022-01-17 15:08 ` Bernhard Beschow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.