aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-08-31 17:07:33 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:27:09 -0400
commit8110fa1d94f2997badc2af39231a1d279c5bb1ee (patch)
tree6bff28c7907dfb0cbb367ca113f4d02ea03f3a51 /include
parentdb1015e92e04835c9eb50c29625fe566d1202dbd (diff)
Use DECLARE_*CHECKER* macros
Generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]') Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-12-ehabkost@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-Id: <20200831210740.126168-13-ehabkost@redhat.com> Message-Id: <20200831210740.126168-14-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/authz/base.h11
-rw-r--r--include/authz/list.h11
-rw-r--r--include/authz/listfile.h11
-rw-r--r--include/authz/pamacct.h11
-rw-r--r--include/authz/simple.h11
-rw-r--r--include/block/throttle-groups.h3
-rw-r--r--include/chardev/char-fd.h3
-rw-r--r--include/chardev/char-win.h3
-rw-r--r--include/chardev/char.h7
-rw-r--r--include/chardev/spice.h3
-rw-r--r--include/crypto/secret.h4
-rw-r--r--include/crypto/secret_common.h10
-rw-r--r--include/crypto/secret_keyring.h11
-rw-r--r--include/crypto/tls-cipher-suites.h4
-rw-r--r--include/crypto/tlscreds.h4
-rw-r--r--include/crypto/tlscredsanon.h4
-rw-r--r--include/crypto/tlscredspsk.h4
-rw-r--r--include/crypto/tlscredsx509.h4
-rw-r--r--include/exec/memory.h14
-rw-r--r--include/hw/acpi/acpi_dev_interface.h8
-rw-r--r--include/hw/acpi/generic_event_device.h4
-rw-r--r--include/hw/acpi/vmgenid.h3
-rw-r--r--include/hw/adc/stm32f2xx_adc.h4
-rw-r--r--include/hw/arm/allwinner-a10.h3
-rw-r--r--include/hw/arm/allwinner-h3.h3
-rw-r--r--include/hw/arm/armsse.h7
-rw-r--r--include/hw/arm/armv7m.h6
-rw-r--r--include/hw/arm/aspeed.h8
-rw-r--r--include/hw/arm/aspeed_soc.h7
-rw-r--r--include/hw/arm/bcm2835_peripherals.h4
-rw-r--r--include/hw/arm/bcm2836.h7
-rw-r--r--include/hw/arm/digic.h3
-rw-r--r--include/hw/arm/exynos4210.h4
-rw-r--r--include/hw/arm/fsl-imx25.h3
-rw-r--r--include/hw/arm/fsl-imx31.h3
-rw-r--r--include/hw/arm/fsl-imx6.h3
-rw-r--r--include/hw/arm/fsl-imx6ul.h3
-rw-r--r--include/hw/arm/fsl-imx7.h3
-rw-r--r--include/hw/arm/linux-boot-if.h6
-rw-r--r--include/hw/arm/msf2-soc.h3
-rw-r--r--include/hw/arm/nrf51_soc.h4
-rw-r--r--include/hw/arm/omap.h15
-rw-r--r--include/hw/arm/pxa.h14
-rw-r--r--include/hw/arm/smmu-common.h7
-rw-r--r--include/hw/arm/smmuv3.h7
-rw-r--r--include/hw/arm/stm32f205_soc.h4
-rw-r--r--include/hw/arm/stm32f405_soc.h4
-rw-r--r--include/hw/arm/virt.h8
-rw-r--r--include/hw/arm/xlnx-versal.h3
-rw-r--r--include/hw/arm/xlnx-zynqmp.h4
-rw-r--r--include/hw/block/flash.h8
-rw-r--r--include/hw/block/swim.h9
-rw-r--r--include/hw/boards.h8
-rw-r--r--include/hw/char/avr_usart.h4
-rw-r--r--include/hw/char/bcm2835_aux.h3
-rw-r--r--include/hw/char/cadence_uart.h4
-rw-r--r--include/hw/char/cmsdk-apb-uart.h4
-rw-r--r--include/hw/char/digic-uart.h4
-rw-r--r--include/hw/char/escc.h3
-rw-r--r--include/hw/char/ibex_uart.h4
-rw-r--r--include/hw/char/imx_serial.h3
-rw-r--r--include/hw/char/nrf51_uart.h3
-rw-r--r--include/hw/char/pl011.h3
-rw-r--r--include/hw/char/renesas_sci.h3
-rw-r--r--include/hw/char/serial.h9
-rw-r--r--include/hw/char/stm32f2xx_usart.h4
-rw-r--r--include/hw/clock.h3
-rw-r--r--include/hw/core/cpu.h4
-rw-r--r--include/hw/core/generic-loader.h4
-rw-r--r--include/hw/core/split-irq.h3
-rw-r--r--include/hw/cpu/a15mpcore.h4
-rw-r--r--include/hw/cpu/a9mpcore.h4
-rw-r--r--include/hw/cpu/arm11mpcore.h4
-rw-r--r--include/hw/cpu/cluster.h4
-rw-r--r--include/hw/cpu/core.h4
-rw-r--r--include/hw/display/bcm2835_fb.h3
-rw-r--r--include/hw/display/dpcd.h3
-rw-r--r--include/hw/display/i2c-ddc.h3
-rw-r--r--include/hw/display/macfb.h12
-rw-r--r--include/hw/display/xlnx_dp.h3
-rw-r--r--include/hw/dma/bcm2835_dma.h4
-rw-r--r--include/hw/dma/i8257.h4
-rw-r--r--include/hw/dma/pl080.h3
-rw-r--r--include/hw/dma/xlnx-zdma.h4
-rw-r--r--include/hw/dma/xlnx-zynq-devcfg.h4
-rw-r--r--include/hw/dma/xlnx_dpdma.h3
-rw-r--r--include/hw/fw-path-provider.h6
-rw-r--r--include/hw/gpio/aspeed_gpio.h7
-rw-r--r--include/hw/gpio/bcm2835_gpio.h4
-rw-r--r--include/hw/gpio/imx_gpio.h3
-rw-r--r--include/hw/gpio/nrf51_gpio.h3
-rw-r--r--include/hw/hotplug.h6
-rw-r--r--include/hw/hyperv/vmbus-bridge.h3
-rw-r--r--include/hw/hyperv/vmbus.h11
-rw-r--r--include/hw/i2c/arm_sbcon_i2c.h4
-rw-r--r--include/hw/i2c/aspeed_i2c.h8
-rw-r--r--include/hw/i2c/i2c.h11
-rw-r--r--include/hw/i2c/imx_i2c.h3
-rw-r--r--include/hw/i2c/microbit_i2c.h4
-rw-r--r--include/hw/i2c/ppc4xx_i2c.h3
-rw-r--r--include/hw/i2c/smbus_slave.h8
-rw-r--r--include/hw/i386/apic_internal.h8
-rw-r--r--include/hw/i386/ich9.h4
-rw-r--r--include/hw/i386/intel_iommu.h4
-rw-r--r--include/hw/i386/ioapic_internal.h8
-rw-r--r--include/hw/i386/microvm.h8
-rw-r--r--include/hw/i386/pc.h8
-rw-r--r--include/hw/i386/x86-iommu.h8
-rw-r--r--include/hw/i386/x86.h8
-rw-r--r--include/hw/ide/ahci.h11
-rw-r--r--include/hw/ide/internal.h11
-rw-r--r--include/hw/ide/pci.h3
-rw-r--r--include/hw/input/adb.h10
-rw-r--r--include/hw/input/i8042.h3
-rw-r--r--include/hw/intc/allwinner-a10-pic.h3
-rw-r--r--include/hw/intc/arm_gic_common.h8
-rw-r--r--include/hw/intc/arm_gicv3_common.h8
-rw-r--r--include/hw/intc/arm_gicv3_its_common.h8
-rw-r--r--include/hw/intc/armv7m_nvic.h4
-rw-r--r--include/hw/intc/aspeed_vic.h3
-rw-r--r--include/hw/intc/bcm2835_ic.h3
-rw-r--r--include/hw/intc/bcm2836_control.h4
-rw-r--r--include/hw/intc/heathrow_pic.h3
-rw-r--r--include/hw/intc/ibex_plic.h4
-rw-r--r--include/hw/intc/imx_avic.h3
-rw-r--r--include/hw/intc/imx_gpcv2.h3
-rw-r--r--include/hw/intc/intc.h6
-rw-r--r--include/hw/intc/mips_gic.h3
-rw-r--r--include/hw/intc/realview_gic.h4
-rw-r--r--include/hw/intc/rx_icu.h3
-rw-r--r--include/hw/intc/xlnx-pmu-iomod-intc.h4
-rw-r--r--include/hw/intc/xlnx-zynqmp-ipi.h4
-rw-r--r--include/hw/ipack/ipack.h11
-rw-r--r--include/hw/ipmi/ipmi.h18
-rw-r--r--include/hw/isa/i8259_internal.h8
-rw-r--r--include/hw/isa/isa.h17
-rw-r--r--include/hw/isa/pc87312.h3
-rw-r--r--include/hw/isa/superio.h8
-rw-r--r--include/hw/m68k/mcf_fec.h3
-rw-r--r--include/hw/mem/memory-device.h6
-rw-r--r--include/hw/mem/nvdimm.h6
-rw-r--r--include/hw/mem/pc-dimm.h8
-rw-r--r--include/hw/mips/cps.h3
-rw-r--r--include/hw/misc/a9scu.h3
-rw-r--r--include/hw/misc/allwinner-cpucfg.h4
-rw-r--r--include/hw/misc/allwinner-h3-ccu.h4
-rw-r--r--include/hw/misc/allwinner-h3-dramc.h4
-rw-r--r--include/hw/misc/allwinner-h3-sysctrl.h4
-rw-r--r--include/hw/misc/allwinner-sid.h4
-rw-r--r--include/hw/misc/arm11scu.h3
-rw-r--r--include/hw/misc/armsse-cpuid.h3
-rw-r--r--include/hw/misc/armsse-mhu.h3
-rw-r--r--include/hw/misc/aspeed_scu.h7
-rw-r--r--include/hw/misc/aspeed_sdmc.h7
-rw-r--r--include/hw/misc/aspeed_xdma.h3
-rw-r--r--include/hw/misc/auxbus.h10
-rw-r--r--include/hw/misc/avr_power.h3
-rw-r--r--include/hw/misc/bcm2835_mbox.h4
-rw-r--r--include/hw/misc/bcm2835_mphi.h4
-rw-r--r--include/hw/misc/bcm2835_property.h4
-rw-r--r--include/hw/misc/bcm2835_rng.h4
-rw-r--r--include/hw/misc/bcm2835_thermal.h4
-rw-r--r--include/hw/misc/grlib_ahb_apb_pnp.h8
-rw-r--r--include/hw/misc/imx25_ccm.h3
-rw-r--r--include/hw/misc/imx31_ccm.h3
-rw-r--r--include/hw/misc/imx6_ccm.h3
-rw-r--r--include/hw/misc/imx6_src.h3
-rw-r--r--include/hw/misc/imx6ul_ccm.h3
-rw-r--r--include/hw/misc/imx7_ccm.h6
-rw-r--r--include/hw/misc/imx7_gpr.h3
-rw-r--r--include/hw/misc/imx7_snvs.h3
-rw-r--r--include/hw/misc/imx_ccm.h8
-rw-r--r--include/hw/misc/imx_rngc.h3
-rw-r--r--include/hw/misc/iotkit-secctl.h3
-rw-r--r--include/hw/misc/iotkit-sysctl.h4
-rw-r--r--include/hw/misc/iotkit-sysinfo.h4
-rw-r--r--include/hw/misc/mac_via.h11
-rw-r--r--include/hw/misc/macio/cuda.h7
-rw-r--r--include/hw/misc/macio/gpio.h3
-rw-r--r--include/hw/misc/macio/macio.h17
-rw-r--r--include/hw/misc/macio/pmu.h7
-rw-r--r--include/hw/misc/max111x.h4
-rw-r--r--include/hw/misc/mips_cmgcr.h3
-rw-r--r--include/hw/misc/mips_cpc.h3
-rw-r--r--include/hw/misc/mips_itu.h3
-rw-r--r--include/hw/misc/mos6522.h7
-rw-r--r--include/hw/misc/mps2-fpgaio.h3
-rw-r--r--include/hw/misc/mps2-scc.h3
-rw-r--r--include/hw/misc/msf2-sysreg.h3
-rw-r--r--include/hw/misc/nrf51_rng.h3
-rw-r--r--include/hw/misc/pca9552.h3
-rw-r--r--include/hw/misc/stm32f2xx_syscfg.h4
-rw-r--r--include/hw/misc/stm32f4xx_exti.h4
-rw-r--r--include/hw/misc/stm32f4xx_syscfg.h4
-rw-r--r--include/hw/misc/tz-mpc.h3
-rw-r--r--include/hw/misc/tz-msc.h3
-rw-r--r--include/hw/misc/tz-ppc.h3
-rw-r--r--include/hw/misc/unimp.h4
-rw-r--r--include/hw/misc/vmcoreinfo.h3
-rw-r--r--include/hw/misc/zynq-xadc.h4
-rw-r--r--include/hw/net/allwinner-sun8i-emac.h4
-rw-r--r--include/hw/net/allwinner_emac.h3
-rw-r--r--include/hw/net/cadence_gem.h3
-rw-r--r--include/hw/net/ftgmac100.h6
-rw-r--r--include/hw/net/imx_fec.h3
-rw-r--r--include/hw/net/lance.h4
-rw-r--r--include/hw/net/lasi_82596.h4
-rw-r--r--include/hw/net/msf2-emac.h4
-rw-r--r--include/hw/nmi.h6
-rw-r--r--include/hw/nubus/mac-nubus-bridge.h4
-rw-r--r--include/hw/nubus/nubus.h7
-rw-r--r--include/hw/nvram/fw_cfg.h15
-rw-r--r--include/hw/nvram/nrf51_nvm.h3
-rw-r--r--include/hw/or-irq.h3
-rw-r--r--include/hw/pci-bridge/simba.h4
-rw-r--r--include/hw/pci-host/designware.h8
-rw-r--r--include/hw/pci-host/gpex.h8
-rw-r--r--include/hw/pci-host/i440fx.h4
-rw-r--r--include/hw/pci-host/pnv_phb3.h9
-rw-r--r--include/hw/pci-host/pnv_phb4.h15
-rw-r--r--include/hw/pci-host/q35.h8
-rw-r--r--include/hw/pci-host/sabre.h8
-rw-r--r--include/hw/pci-host/spapr.h4
-rw-r--r--include/hw/pci-host/uninorth.h20
-rw-r--r--include/hw/pci-host/xilinx-pcie.h8
-rw-r--r--include/hw/pci/pci.h13
-rw-r--r--include/hw/pci/pci_bridge.h3
-rw-r--r--include/hw/pci/pci_host.h8
-rw-r--r--include/hw/pci/pcie_host.h4
-rw-r--r--include/hw/pci/pcie_port.h12
-rw-r--r--include/hw/pcmcia.h8
-rw-r--r--include/hw/platform-bus.h4
-rw-r--r--include/hw/ppc/mac_dbdma.h3
-rw-r--r--include/hw/ppc/openpic.h3
-rw-r--r--include/hw/ppc/pnv.h44
-rw-r--r--include/hw/ppc/pnv_core.h12
-rw-r--r--include/hw/ppc/pnv_homer.h13
-rw-r--r--include/hw/ppc/pnv_lpc.h17
-rw-r--r--include/hw/ppc/pnv_occ.h13
-rw-r--r--include/hw/ppc/pnv_pnor.h3
-rw-r--r--include/hw/ppc/pnv_psi.h16
-rw-r--r--include/hw/ppc/pnv_xive.h7
-rw-r--r--include/hw/ppc/pnv_xscom.h5
-rw-r--r--include/hw/ppc/spapr.h20
-rw-r--r--include/hw/ppc/spapr_cpu_core.h8
-rw-r--r--include/hw/ppc/spapr_irq.h6
-rw-r--r--include/hw/ppc/spapr_tpm_proxy.h4
-rw-r--r--include/hw/ppc/spapr_vio.h11
-rw-r--r--include/hw/ppc/xics.h23
-rw-r--r--include/hw/ppc/xive.h36
-rw-r--r--include/hw/qdev-core.h10
-rw-r--r--include/hw/rdma/rdma.h6
-rw-r--r--include/hw/register.h3
-rw-r--r--include/hw/resettable.h6
-rw-r--r--include/hw/riscv/opentitan.h4
-rw-r--r--include/hw/riscv/riscv_hart.h4
-rw-r--r--include/hw/riscv/spike.h4
-rw-r--r--include/hw/riscv/virt.h4
-rw-r--r--include/hw/rtc/allwinner-rtc.h8
-rw-r--r--include/hw/rtc/aspeed_rtc.h3
-rw-r--r--include/hw/rtc/goldfish_rtc.h4
-rw-r--r--include/hw/rtc/m48t59.h6
-rw-r--r--include/hw/rtc/mc146818rtc.h3
-rw-r--r--include/hw/rtc/pl031.h3
-rw-r--r--include/hw/rtc/xlnx-zynqmp-rtc.h4
-rw-r--r--include/hw/rx/rx62n.h3
-rw-r--r--include/hw/s390x/3270-ccw.h8
-rw-r--r--include/hw/s390x/ap-device.h4
-rw-r--r--include/hw/s390x/css-bridge.h8
-rw-r--r--include/hw/s390x/event-facility.h18
-rw-r--r--include/hw/s390x/s390-ccw.h8
-rw-r--r--include/hw/s390x/s390-virtio-ccw.h6
-rw-r--r--include/hw/s390x/s390_flic.h16
-rw-r--r--include/hw/s390x/sclp.h5
-rw-r--r--include/hw/s390x/storage-attributes.h16
-rw-r--r--include/hw/s390x/storage-keys.h12
-rw-r--r--include/hw/s390x/tod.h7
-rw-r--r--include/hw/s390x/vfio-ccw.h4
-rw-r--r--include/hw/scsi/esp.h3
-rw-r--r--include/hw/scsi/scsi.h11
-rw-r--r--include/hw/sd/allwinner-sdhost.h8
-rw-r--r--include/hw/sd/aspeed_sdhci.h4
-rw-r--r--include/hw/sd/bcm2835_sdhost.h4
-rw-r--r--include/hw/sd/sd.h12
-rw-r--r--include/hw/sd/sdhci.h7
-rw-r--r--include/hw/southbridge/piix.h4
-rw-r--r--include/hw/sparc/sparc32_dma.h16
-rw-r--r--include/hw/sparc/sun4m_iommu.h3
-rw-r--r--include/hw/sparc/sun4u_iommu.h3
-rw-r--r--include/hw/ssi/aspeed_smc.h7
-rw-r--r--include/hw/ssi/imx_spi.h3
-rw-r--r--include/hw/ssi/mss-spi.h3
-rw-r--r--include/hw/ssi/pl022.h3
-rw-r--r--include/hw/ssi/ssi.h8
-rw-r--r--include/hw/ssi/stm32f2xx_spi.h4
-rw-r--r--include/hw/ssi/xilinx_spips.h20
-rw-r--r--include/hw/stream.h6
-rw-r--r--include/hw/sysbus.h11
-rw-r--r--include/hw/timer/a9gtimer.h3
-rw-r--r--include/hw/timer/allwinner-a10-pit.h3
-rw-r--r--include/hw/timer/arm_mptimer.h4
-rw-r--r--include/hw/timer/armv7m_systick.h3
-rw-r--r--include/hw/timer/aspeed_timer.h8
-rw-r--r--include/hw/timer/avr_timer16.h4
-rw-r--r--include/hw/timer/bcm2835_systmr.h4
-rw-r--r--include/hw/timer/cmsdk-apb-dualtimer.h4
-rw-r--r--include/hw/timer/cmsdk-apb-timer.h4
-rw-r--r--include/hw/timer/digic-timer.h3
-rw-r--r--include/hw/timer/i8254.h8
-rw-r--r--include/hw/timer/imx_epit.h3
-rw-r--r--include/hw/timer/imx_gpt.h3
-rw-r--r--include/hw/timer/mss-timer.h4
-rw-r--r--include/hw/timer/nrf51_timer.h3
-rw-r--r--include/hw/timer/renesas_cmt.h3
-rw-r--r--include/hw/timer/renesas_tmr.h3
-rw-r--r--include/hw/timer/stm32f2xx_timer.h4
-rw-r--r--include/hw/usb.h11
-rw-r--r--include/hw/usb/chipidea.h3
-rw-r--r--include/hw/usb/imx-usb-phy.h3
-rw-r--r--include/hw/vfio/vfio-amd-xgbe.h10
-rw-r--r--include/hw/vfio/vfio-calxeda-xgmac.h10
-rw-r--r--include/hw/vfio/vfio-platform.h8
-rw-r--r--include/hw/virtio/vhost-scsi-common.h4
-rw-r--r--include/hw/virtio/vhost-scsi.h4
-rw-r--r--include/hw/virtio/vhost-user-blk.h4
-rw-r--r--include/hw/virtio/vhost-user-fs.h4
-rw-r--r--include/hw/virtio/vhost-user-scsi.h4
-rw-r--r--include/hw/virtio/vhost-user-vsock.h4
-rw-r--r--include/hw/virtio/vhost-vsock-common.h4
-rw-r--r--include/hw/virtio/vhost-vsock.h4
-rw-r--r--include/hw/virtio/virtio-balloon.h4
-rw-r--r--include/hw/virtio/virtio-blk.h4
-rw-r--r--include/hw/virtio/virtio-bus.h7
-rw-r--r--include/hw/virtio/virtio-crypto.h4
-rw-r--r--include/hw/virtio/virtio-gpu-pci.h4
-rw-r--r--include/hw/virtio/virtio-gpu.h16
-rw-r--r--include/hw/virtio/virtio-input.h20
-rw-r--r--include/hw/virtio/virtio-iommu.h4
-rw-r--r--include/hw/virtio/virtio-mem.h8
-rw-r--r--include/hw/virtio/virtio-mmio.h4
-rw-r--r--include/hw/virtio/virtio-net.h4
-rw-r--r--include/hw/virtio/virtio-pmem.h8
-rw-r--r--include/hw/virtio/virtio-rng.h4
-rw-r--r--include/hw/virtio/virtio-scsi.h8
-rw-r--r--include/hw/virtio/virtio-serial.h16
-rw-r--r--include/hw/virtio/virtio.h8
-rw-r--r--include/hw/vmstate-if.h6
-rw-r--r--include/hw/watchdog/cmsdk-apb-watchdog.h4
-rw-r--r--include/hw/watchdog/wdt_aspeed.h8
-rw-r--r--include/hw/watchdog/wdt_diag288.h8
-rw-r--r--include/hw/watchdog/wdt_imx2.h3
-rw-r--r--include/hw/xen/xen-block.h16
-rw-r--r--include/hw/xen/xen-bus.h16
-rw-r--r--include/hw/xen/xen-legacy-backend.h4
-rw-r--r--include/io/channel-buffer.h4
-rw-r--r--include/io/channel-command.h4
-rw-r--r--include/io/channel-file.h4
-rw-r--r--include/io/channel-socket.h4
-rw-r--r--include/io/channel-tls.h4
-rw-r--r--include/io/channel-websock.h4
-rw-r--r--include/io/channel.h8
-rw-r--r--include/io/dns-resolver.h8
-rw-r--r--include/io/net-listener.h8
-rw-r--r--include/net/can_emu.h4
-rw-r--r--include/net/can_host.h8
-rw-r--r--include/net/filter.h8
-rw-r--r--include/qom/object_interfaces.h8
-rw-r--r--include/scsi/pr-manager.h8
-rw-r--r--include/sysemu/cryptodev.h11
-rw-r--r--include/sysemu/hostmem.h8
-rw-r--r--include/sysemu/hvf.h4
-rw-r--r--include/sysemu/iothread.h4
-rw-r--r--include/sysemu/kvm.h4
-rw-r--r--include/sysemu/rng-random.h3
-rw-r--r--include/sysemu/rng.h8
-rw-r--r--include/sysemu/tpm.h6
-rw-r--r--include/sysemu/tpm_backend.h8
-rw-r--r--include/sysemu/vhost-user-backend.h8
-rw-r--r--include/ui/console.h8
379 files changed, 994 insertions, 1338 deletions
diff --git a/include/authz/base.h b/include/authz/base.h
index c01946b4ce..8d8cf9fa5a 100644
--- a/include/authz/base.h
+++ b/include/authz/base.h
@@ -29,15 +29,8 @@
typedef struct QAuthZ QAuthZ;
typedef struct QAuthZClass QAuthZClass;
-#define QAUTHZ_CLASS(klass) \
- OBJECT_CLASS_CHECK(QAuthZClass, (klass), \
- TYPE_QAUTHZ)
-#define QAUTHZ_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QAuthZClass, (obj), \
- TYPE_QAUTHZ)
-#define QAUTHZ(obj) \
- OBJECT_CHECK(QAuthZ, (obj), \
- TYPE_QAUTHZ)
+DECLARE_OBJ_CHECKERS(QAuthZ, QAuthZClass,
+ QAUTHZ, TYPE_QAUTHZ)
/**
diff --git a/include/authz/list.h b/include/authz/list.h
index 5d5e8e803f..93d16876bc 100644
--- a/include/authz/list.h
+++ b/include/authz/list.h
@@ -29,15 +29,8 @@
typedef struct QAuthZList QAuthZList;
typedef struct QAuthZListClass QAuthZListClass;
-#define QAUTHZ_LIST_CLASS(klass) \
- OBJECT_CLASS_CHECK(QAuthZListClass, (klass), \
- TYPE_QAUTHZ_LIST)
-#define QAUTHZ_LIST_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QAuthZListClass, (obj), \
- TYPE_QAUTHZ_LIST)
-#define QAUTHZ_LIST(obj) \
- OBJECT_CHECK(QAuthZList, (obj), \
- TYPE_QAUTHZ_LIST)
+DECLARE_OBJ_CHECKERS(QAuthZList, QAuthZListClass,
+ QAUTHZ_LIST, TYPE_QAUTHZ_LIST)
diff --git a/include/authz/listfile.h b/include/authz/listfile.h
index 11169ac882..2e4a629b6d 100644
--- a/include/authz/listfile.h
+++ b/include/authz/listfile.h
@@ -29,15 +29,8 @@
typedef struct QAuthZListFile QAuthZListFile;
typedef struct QAuthZListFileClass QAuthZListFileClass;
-#define QAUTHZ_LIST_FILE_CLASS(klass) \
- OBJECT_CLASS_CHECK(QAuthZListFileClass, (klass), \
- TYPE_QAUTHZ_LIST_FILE)
-#define QAUTHZ_LIST_FILE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QAuthZListFileClass, (obj), \
- TYPE_QAUTHZ_LIST_FILE)
-#define QAUTHZ_LIST_FILE(obj) \
- OBJECT_CHECK(QAuthZListFile, (obj), \
- TYPE_QAUTHZ_LIST_FILE)
+DECLARE_OBJ_CHECKERS(QAuthZListFile, QAuthZListFileClass,
+ QAUTHZ_LIST_FILE, TYPE_QAUTHZ_LIST_FILE)
diff --git a/include/authz/pamacct.h b/include/authz/pamacct.h
index a14cf33fb4..98454ddc25 100644
--- a/include/authz/pamacct.h
+++ b/include/authz/pamacct.h
@@ -29,15 +29,8 @@
typedef struct QAuthZPAM QAuthZPAM;
typedef struct QAuthZPAMClass QAuthZPAMClass;
-#define QAUTHZ_PAM_CLASS(klass) \
- OBJECT_CLASS_CHECK(QAuthZPAMClass, (klass), \
- TYPE_QAUTHZ_PAM)
-#define QAUTHZ_PAM_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QAuthZPAMClass, (obj), \
- TYPE_QAUTHZ_PAM)
-#define QAUTHZ_PAM(obj) \
- OBJECT_CHECK(QAuthZPAM, (obj), \
- TYPE_QAUTHZ_PAM)
+DECLARE_OBJ_CHECKERS(QAuthZPAM, QAuthZPAMClass,
+ QAUTHZ_PAM, TYPE_QAUTHZ_PAM)
diff --git a/include/authz/simple.h b/include/authz/simple.h
index df8c1bf39c..7a896fb94b 100644
--- a/include/authz/simple.h
+++ b/include/authz/simple.h
@@ -28,15 +28,8 @@
typedef struct QAuthZSimple QAuthZSimple;
typedef struct QAuthZSimpleClass QAuthZSimpleClass;
-#define QAUTHZ_SIMPLE_CLASS(klass) \
- OBJECT_CLASS_CHECK(QAuthZSimpleClass, (klass), \
- TYPE_QAUTHZ_SIMPLE)
-#define QAUTHZ_SIMPLE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QAuthZSimpleClass, (obj), \
- TYPE_QAUTHZ_SIMPLE)
-#define QAUTHZ_SIMPLE(obj) \
- OBJECT_CHECK(QAuthZSimple, (obj), \
- TYPE_QAUTHZ_SIMPLE)
+DECLARE_OBJ_CHECKERS(QAuthZSimple, QAuthZSimpleClass,
+ QAUTHZ_SIMPLE, TYPE_QAUTHZ_SIMPLE)
diff --git a/include/block/throttle-groups.h b/include/block/throttle-groups.h
index 7c6f572cf9..20b308f619 100644
--- a/include/block/throttle-groups.h
+++ b/include/block/throttle-groups.h
@@ -61,7 +61,8 @@ typedef struct ThrottleGroupMember {
#define TYPE_THROTTLE_GROUP "throttle-group"
typedef struct ThrottleGroup ThrottleGroup;
-#define THROTTLE_GROUP(obj) OBJECT_CHECK(ThrottleGroup, (obj), TYPE_THROTTLE_GROUP)
+DECLARE_INSTANCE_CHECKER(ThrottleGroup, THROTTLE_GROUP,
+ TYPE_THROTTLE_GROUP)
const char *throttle_group_get_name(ThrottleGroupMember *tgm);
diff --git a/include/chardev/char-fd.h b/include/chardev/char-fd.h
index 1442dcaa62..9de0e440de 100644
--- a/include/chardev/char-fd.h
+++ b/include/chardev/char-fd.h
@@ -38,7 +38,8 @@ typedef struct FDChardev FDChardev;
#define TYPE_CHARDEV_FD "chardev-fd"
-#define FD_CHARDEV(obj) OBJECT_CHECK(FDChardev, (obj), TYPE_CHARDEV_FD)
+DECLARE_INSTANCE_CHECKER(FDChardev, FD_CHARDEV,
+ TYPE_CHARDEV_FD)
void qemu_chr_open_fd(Chardev *chr, int fd_in, int fd_out);
int qmp_chardev_open_file_source(char *src, int flags, Error **errp);
diff --git a/include/chardev/char-win.h b/include/chardev/char-win.h
index f1632330f1..485521469c 100644
--- a/include/chardev/char-win.h
+++ b/include/chardev/char-win.h
@@ -44,7 +44,8 @@ typedef struct WinChardev WinChardev;
#define NRECVBUF 2048
#define TYPE_CHARDEV_WIN "chardev-win"
-#define WIN_CHARDEV(obj) OBJECT_CHECK(WinChardev, (obj), TYPE_CHARDEV_WIN)
+DECLARE_INSTANCE_CHECKER(WinChardev, WIN_CHARDEV,
+ TYPE_CHARDEV_WIN)
void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open);
int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp);
diff --git a/include/chardev/char.h b/include/chardev/char.h
index d91d851b33..5874de57ea 100644
--- a/include/chardev/char.h
+++ b/include/chardev/char.h
@@ -227,11 +227,8 @@ int qemu_chr_wait_connected(Chardev *chr, Error **errp);
#define TYPE_CHARDEV "chardev"
typedef struct ChardevClass ChardevClass;
-#define CHARDEV(obj) OBJECT_CHECK(Chardev, (obj), TYPE_CHARDEV)
-#define CHARDEV_CLASS(klass) \
- OBJECT_CLASS_CHECK(ChardevClass, (klass), TYPE_CHARDEV)
-#define CHARDEV_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ChardevClass, (obj), TYPE_CHARDEV)
+DECLARE_OBJ_CHECKERS(Chardev, ChardevClass,
+ CHARDEV, TYPE_CHARDEV)
#define TYPE_CHARDEV_NULL "chardev-null"
#define TYPE_CHARDEV_MUX "chardev-mux"
diff --git a/include/chardev/spice.h b/include/chardev/spice.h
index 5bccc47392..99f26aedde 100644
--- a/include/chardev/spice.h
+++ b/include/chardev/spice.h
@@ -21,7 +21,8 @@ typedef struct SpiceChardev SpiceChardev;
#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc"
#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport"
-#define SPICE_CHARDEV(obj) OBJECT_CHECK(SpiceChardev, (obj), TYPE_CHARDEV_SPICE)
+DECLARE_INSTANCE_CHECKER(SpiceChardev, SPICE_CHARDEV,
+ TYPE_CHARDEV_SPICE)
void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend,
bool *be_opened, Error **errp);
diff --git a/include/crypto/secret.h b/include/crypto/secret.h
index 8c03971e75..5d20ae6d2f 100644
--- a/include/crypto/secret.h
+++ b/include/crypto/secret.h
@@ -27,8 +27,8 @@
#define TYPE_QCRYPTO_SECRET "secret"
typedef struct QCryptoSecret QCryptoSecret;
-#define QCRYPTO_SECRET(obj) \
- OBJECT_CHECK(QCryptoSecret, (obj), TYPE_QCRYPTO_SECRET)
+DECLARE_INSTANCE_CHECKER(QCryptoSecret, QCRYPTO_SECRET,
+ TYPE_QCRYPTO_SECRET)
typedef struct QCryptoSecretClass QCryptoSecretClass;
diff --git a/include/crypto/secret_common.h b/include/crypto/secret_common.h
index db282a3872..dd3310ea5f 100644
--- a/include/crypto/secret_common.h
+++ b/include/crypto/secret_common.h
@@ -27,14 +27,8 @@
#define TYPE_QCRYPTO_SECRET_COMMON "secret_common"
typedef struct QCryptoSecretCommon QCryptoSecretCommon;
typedef struct QCryptoSecretCommonClass QCryptoSecretCommonClass;
-#define QCRYPTO_SECRET_COMMON(obj) \
- OBJECT_CHECK(QCryptoSecretCommon, (obj), TYPE_QCRYPTO_SECRET_COMMON)
-#define QCRYPTO_SECRET_COMMON_CLASS(class) \
- OBJECT_CLASS_CHECK(QCryptoSecretCommonClass, \
- (class), TYPE_QCRYPTO_SECRET_COMMON)
-#define QCRYPTO_SECRET_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QCryptoSecretCommonClass, \
- (obj), TYPE_QCRYPTO_SECRET_COMMON)
+DECLARE_OBJ_CHECKERS(QCryptoSecretCommon, QCryptoSecretCommonClass,
+ QCRYPTO_SECRET_COMMON, TYPE_QCRYPTO_SECRET_COMMON)
struct QCryptoSecretCommon {
diff --git a/include/crypto/secret_keyring.h b/include/crypto/secret_keyring.h
index 8b3b8ee67d..9875f4cbf3 100644
--- a/include/crypto/secret_keyring.h
+++ b/include/crypto/secret_keyring.h
@@ -28,15 +28,8 @@
#define TYPE_QCRYPTO_SECRET_KEYRING "secret_keyring"
typedef struct QCryptoSecretKeyring QCryptoSecretKeyring;
typedef struct QCryptoSecretKeyringClass QCryptoSecretKeyringClass;
-#define QCRYPTO_SECRET_KEYRING(obj) \
- OBJECT_CHECK(QCryptoSecretKeyring, (obj), \
- TYPE_QCRYPTO_SECRET_KEYRING)
-#define QCRYPTO_SECRET_KEYRING_CLASS(class) \
- OBJECT_CLASS_CHECK(QCryptoSecretKeyringClass, \
- (class), TYPE_QCRYPTO_SECRET_KEYRING)
-#define QCRYPTO_SECRET_KEYRING_GET_CLASS(class) \
- OBJECT_GET_CLASS(QCryptoSecretKeyringClass, \
- (class), TYPE_QCRYPTO_SECRET_KEYRING)
+DECLARE_OBJ_CHECKERS(QCryptoSecretKeyring, QCryptoSecretKeyringClass,
+ QCRYPTO_SECRET_KEYRING, TYPE_QCRYPTO_SECRET_KEYRING)
struct QCryptoSecretKeyring {
diff --git a/include/crypto/tls-cipher-suites.h b/include/crypto/tls-cipher-suites.h
index 23f031953f..bb9ee53e03 100644
--- a/include/crypto/tls-cipher-suites.h
+++ b/include/crypto/tls-cipher-suites.h
@@ -16,8 +16,8 @@
#define TYPE_QCRYPTO_TLS_CIPHER_SUITES "tls-cipher-suites"
typedef struct QCryptoTLSCipherSuites QCryptoTLSCipherSuites;
-#define QCRYPTO_TLS_CIPHER_SUITES(obj) \
- OBJECT_CHECK(QCryptoTLSCipherSuites, (obj), TYPE_QCRYPTO_TLS_CIPHER_SUITES)
+DECLARE_INSTANCE_CHECKER(QCryptoTLSCipherSuites, QCRYPTO_TLS_CIPHER_SUITES,
+ TYPE_QCRYPTO_TLS_CIPHER_SUITES)
struct QCryptoTLSCipherSuites {
/* <private> */
diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h
index 9f065a4def..079e376047 100644
--- a/include/crypto/tlscreds.h
+++ b/include/crypto/tlscreds.h
@@ -30,8 +30,8 @@
#define TYPE_QCRYPTO_TLS_CREDS "tls-creds"
typedef struct QCryptoTLSCreds QCryptoTLSCreds;
-#define QCRYPTO_TLS_CREDS(obj) \
- OBJECT_CHECK(QCryptoTLSCreds, (obj), TYPE_QCRYPTO_TLS_CREDS)
+DECLARE_INSTANCE_CHECKER(QCryptoTLSCreds, QCRYPTO_TLS_CREDS,
+ TYPE_QCRYPTO_TLS_CREDS)
typedef struct QCryptoTLSCredsClass QCryptoTLSCredsClass;
diff --git a/include/crypto/tlscredsanon.h b/include/crypto/tlscredsanon.h
index 034ebd3fd9..3f464a3809 100644
--- a/include/crypto/tlscredsanon.h
+++ b/include/crypto/tlscredsanon.h
@@ -26,8 +26,8 @@
#define TYPE_QCRYPTO_TLS_CREDS_ANON "tls-creds-anon"
typedef struct QCryptoTLSCredsAnon QCryptoTLSCredsAnon;
-#define QCRYPTO_TLS_CREDS_ANON(obj) \
- OBJECT_CHECK(QCryptoTLSCredsAnon, (obj), TYPE_QCRYPTO_TLS_CREDS_ANON)
+DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsAnon, QCRYPTO_TLS_CREDS_ANON,
+ TYPE_QCRYPTO_TLS_CREDS_ANON)
typedef struct QCryptoTLSCredsAnonClass QCryptoTLSCredsAnonClass;
diff --git a/include/crypto/tlscredspsk.h b/include/crypto/tlscredspsk.h
index 6e361366eb..d7e6bdb5ed 100644
--- a/include/crypto/tlscredspsk.h
+++ b/include/crypto/tlscredspsk.h
@@ -26,8 +26,8 @@
#define TYPE_QCRYPTO_TLS_CREDS_PSK "tls-creds-psk"
typedef struct QCryptoTLSCredsPSK QCryptoTLSCredsPSK;
-#define QCRYPTO_TLS_CREDS_PSK(obj) \
- OBJECT_CHECK(QCryptoTLSCredsPSK, (obj), TYPE_QCRYPTO_TLS_CREDS_PSK)
+DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsPSK, QCRYPTO_TLS_CREDS_PSK,
+ TYPE_QCRYPTO_TLS_CREDS_PSK)
typedef struct QCryptoTLSCredsPSKClass QCryptoTLSCredsPSKClass;
diff --git a/include/crypto/tlscredsx509.h b/include/crypto/tlscredsx509.h
index e4d44ea22d..c6d89b7881 100644
--- a/include/crypto/tlscredsx509.h
+++ b/include/crypto/tlscredsx509.h
@@ -26,8 +26,8 @@
#define TYPE_QCRYPTO_TLS_CREDS_X509 "tls-creds-x509"
typedef struct QCryptoTLSCredsX509 QCryptoTLSCredsX509;
-#define QCRYPTO_TLS_CREDS_X509(obj) \
- OBJECT_CHECK(QCryptoTLSCredsX509, (obj), TYPE_QCRYPTO_TLS_CREDS_X509)
+DECLARE_INSTANCE_CHECKER(QCryptoTLSCredsX509, QCRYPTO_TLS_CREDS_X509,
+ TYPE_QCRYPTO_TLS_CREDS_X509)
typedef struct QCryptoTLSCredsX509Class QCryptoTLSCredsX509Class;
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 5c17a21c65..f1bb2a7df5 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -34,19 +34,13 @@
#define MAX_PHYS_ADDR (((hwaddr)1 << MAX_PHYS_ADDR_SPACE_BITS) - 1)
#define TYPE_MEMORY_REGION "qemu:memory-region"
-#define MEMORY_REGION(obj) \
- OBJECT_CHECK(MemoryRegion, (obj), TYPE_MEMORY_REGION)
+DECLARE_INSTANCE_CHECKER(MemoryRegion, MEMORY_REGION,
+ TYPE_MEMORY_REGION)
#define TYPE_IOMMU_MEMORY_REGION "qemu:iommu-memory-region"
typedef struct IOMMUMemoryRegionClass IOMMUMemoryRegionClass;
-#define IOMMU_MEMORY_REGION(obj) \
- OBJECT_CHECK(IOMMUMemoryRegion, (obj), TYPE_IOMMU_MEMORY_REGION)
-#define IOMMU_MEMORY_REGION_CLASS(klass) \
- OBJECT_CLASS_CHECK(IOMMUMemoryRegionClass, (klass), \
- TYPE_IOMMU_MEMORY_REGION)
-#define IOMMU_MEMORY_REGION_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IOMMUMemoryRegionClass, (obj), \
- TYPE_IOMMU_MEMORY_REGION)
+DECLARE_OBJ_CHECKERS(IOMMUMemoryRegion, IOMMUMemoryRegionClass,
+ IOMMU_MEMORY_REGION, TYPE_IOMMU_MEMORY_REGION)
extern bool global_dirty_log;
diff --git a/include/hw/acpi/acpi_dev_interface.h b/include/hw/acpi/acpi_dev_interface.h
index 4ef44d6fe8..9adf1e4706 100644
--- a/include/hw/acpi/acpi_dev_interface.h
+++ b/include/hw/acpi/acpi_dev_interface.h
@@ -19,12 +19,8 @@ typedef enum {
#define TYPE_ACPI_DEVICE_IF "acpi-device-interface"
typedef struct AcpiDeviceIfClass AcpiDeviceIfClass;
-#define ACPI_DEVICE_IF_CLASS(klass) \
- OBJECT_CLASS_CHECK(AcpiDeviceIfClass, (klass), \
- TYPE_ACPI_DEVICE_IF)
-#define ACPI_DEVICE_IF_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AcpiDeviceIfClass, (obj), \
- TYPE_ACPI_DEVICE_IF)
+DECLARE_CLASS_CHECKERS(AcpiDeviceIfClass, ACPI_DEVICE_IF,
+ TYPE_ACPI_DEVICE_IF)
#define ACPI_DEVICE_IF(obj) \
INTERFACE_CHECK(AcpiDeviceIf, (obj), \
TYPE_ACPI_DEVICE_IF)
diff --git a/include/hw/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h
index 2208f0b939..1be05a3c0f 100644
--- a/include/hw/acpi/generic_event_device.h
+++ b/include/hw/acpi/generic_event_device.h
@@ -68,8 +68,8 @@
#define TYPE_ACPI_GED "acpi-ged"
typedef struct AcpiGedState AcpiGedState;
-#define ACPI_GED(obj) \
- OBJECT_CHECK(AcpiGedState, (obj), TYPE_ACPI_GED)
+DECLARE_INSTANCE_CHECKER(AcpiGedState, ACPI_GED,
+ TYPE_ACPI_GED)
#define ACPI_GED_EVT_SEL_OFFSET 0x0
#define ACPI_GED_EVT_SEL_LEN 0x4
diff --git a/include/hw/acpi/vmgenid.h b/include/hw/acpi/vmgenid.h
index 0286fc0f09..86cd1da605 100644
--- a/include/hw/acpi/vmgenid.h
+++ b/include/hw/acpi/vmgenid.h
@@ -17,7 +17,8 @@
*/
typedef struct VmGenIdState VmGenIdState;
-#define VMGENID(obj) OBJECT_CHECK(VmGenIdState, (obj), VMGENID_DEVICE)
+DECLARE_INSTANCE_CHECKER(VmGenIdState, VMGENID,
+ VMGENID_DEVICE)
struct VmGenIdState {
DeviceClass parent_obj;
diff --git a/include/hw/adc/stm32f2xx_adc.h b/include/hw/adc/stm32f2xx_adc.h
index 60d4b65570..6a4f8e955b 100644
--- a/include/hw/adc/stm32f2xx_adc.h
+++ b/include/hw/adc/stm32f2xx_adc.h
@@ -60,8 +60,8 @@
#define TYPE_STM32F2XX_ADC "stm32f2xx-adc"
typedef struct STM32F2XXADCState STM32F2XXADCState;
-#define STM32F2XX_ADC(obj) \
- OBJECT_CHECK(STM32F2XXADCState, (obj), TYPE_STM32F2XX_ADC)
+DECLARE_INSTANCE_CHECKER(STM32F2XXADCState, STM32F2XX_ADC,
+ TYPE_STM32F2XX_ADC)
struct STM32F2XXADCState {
/* <private> */
diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h
index 631454f1c7..d13b6cf50f 100644
--- a/include/hw/arm/allwinner-a10.h
+++ b/include/hw/arm/allwinner-a10.h
@@ -23,7 +23,8 @@
#define TYPE_AW_A10 "allwinner-a10"
typedef struct AwA10State AwA10State;
-#define AW_A10(obj) OBJECT_CHECK(AwA10State, (obj), TYPE_AW_A10)
+DECLARE_INSTANCE_CHECKER(AwA10State, AW_A10,
+ TYPE_AW_A10)
struct AwA10State {
/*< private >*/
diff --git a/include/hw/arm/allwinner-h3.h b/include/hw/arm/allwinner-h3.h
index 5fda95066f..a93e019521 100644
--- a/include/hw/arm/allwinner-h3.h
+++ b/include/hw/arm/allwinner-h3.h
@@ -107,7 +107,8 @@ enum {
/** Convert input object to Allwinner H3 state object */
typedef struct AwH3State AwH3State;
-#define AW_H3(obj) OBJECT_CHECK(AwH3State, (obj), TYPE_AW_H3)
+DECLARE_INSTANCE_CHECKER(AwH3State, AW_H3,
+ TYPE_AW_H3)
/** @} */
diff --git a/include/hw/arm/armsse.h b/include/hw/arm/armsse.h
index e5788e9d3c..452cbb5793 100644
--- a/include/hw/arm/armsse.h
+++ b/include/hw/arm/armsse.h
@@ -110,7 +110,8 @@
#define TYPE_ARM_SSE "arm-sse"
typedef struct ARMSSE ARMSSE;
typedef struct ARMSSEClass ARMSSEClass;
-#define ARM_SSE(obj) OBJECT_CHECK(ARMSSE, (obj), TYPE_ARM_SSE)
+DECLARE_OBJ_CHECKERS(ARMSSE, ARMSSEClass,
+ ARM_SSE, TYPE_ARM_SSE)
/*
* These type names are for specific IoTKit subsystems; other than
@@ -227,9 +228,5 @@ struct ARMSSEClass {
const ARMSSEInfo *info;
};
-#define ARM_SSE_CLASS(klass) \
- OBJECT_CLASS_CHECK(ARMSSEClass, (klass), TYPE_ARM_SSE)
-#define ARM_SSE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ARMSSEClass, (obj), TYPE_ARM_SSE)
#endif
diff --git a/include/hw/arm/armv7m.h b/include/hw/arm/armv7m.h
index c820d32ad5..dcb891d9cc 100644
--- a/include/hw/arm/armv7m.h
+++ b/include/hw/arm/armv7m.h
@@ -17,7 +17,8 @@
#define TYPE_BITBAND "ARM,bitband-memory"
typedef struct BitBandState BitBandState;
-#define BITBAND(obj) OBJECT_CHECK(BitBandState, (obj), TYPE_BITBAND)
+DECLARE_INSTANCE_CHECKER(BitBandState, BITBAND,
+ TYPE_BITBAND)
struct BitBandState {
/*< private >*/
@@ -32,7 +33,8 @@ struct BitBandState {
#define TYPE_ARMV7M "armv7m"
typedef struct ARMv7MState ARMv7MState;
-#define ARMV7M(obj) OBJECT_CHECK(ARMv7MState, (obj), TYPE_ARMV7M)
+DECLARE_INSTANCE_CHECKER(ARMv7MState, ARMV7M,
+ TYPE_ARMV7M)
#define ARMV7M_NUM_BITBANDS 2
diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 4e5ec37acb..c9747b15fc 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -16,18 +16,14 @@ typedef struct AspeedMachineState AspeedMachineState;
#define TYPE_ASPEED_MACHINE MACHINE_TYPE_NAME("aspeed")
typedef struct AspeedMachineClass AspeedMachineClass;
-#define ASPEED_MACHINE(obj) \
- OBJECT_CHECK(AspeedMachineState, (obj), TYPE_ASPEED_MACHINE)
+DECLARE_OBJ_CHECKERS(AspeedMachineState, AspeedMachineClass,
+ ASPEED_MACHINE, TYPE_ASPEED_MACHINE)
#define ASPEED_MAC0_ON (1 << 0)
#define ASPEED_MAC1_ON (1 << 1)
#define ASPEED_MAC2_ON (1 << 2)
#define ASPEED_MAC3_ON (1 << 3)
-#define ASPEED_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedMachineClass, (klass), TYPE_ASPEED_MACHINE)
-#define ASPEED_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedMachineClass, (obj), TYPE_ASPEED_MACHINE)
struct AspeedMachineClass {
MachineClass parent_obj;
diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h
index 31679ee42e..05c7d53df3 100644
--- a/include/hw/arm/aspeed_soc.h
+++ b/include/hw/arm/aspeed_soc.h
@@ -66,7 +66,8 @@ typedef struct AspeedSoCState AspeedSoCState;
#define TYPE_ASPEED_SOC "aspeed-soc"
typedef struct AspeedSoCClass AspeedSoCClass;
-#define ASPEED_SOC(obj) OBJECT_CHECK(AspeedSoCState, (obj), TYPE_ASPEED_SOC)
+DECLARE_OBJ_CHECKERS(AspeedSoCState, AspeedSoCClass,
+ ASPEED_SOC, TYPE_ASPEED_SOC)
struct AspeedSoCClass {
DeviceClass parent_class;
@@ -84,10 +85,6 @@ struct AspeedSoCClass {
uint32_t num_cpus;
};
-#define ASPEED_SOC_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedSoCClass, (klass), TYPE_ASPEED_SOC)
-#define ASPEED_SOC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedSoCClass, (obj), TYPE_ASPEED_SOC)
enum {
ASPEED_DEV_IOMEM,
diff --git a/include/hw/arm/bcm2835_peripherals.h b/include/hw/arm/bcm2835_peripherals.h
index 67f5a5f8f5..b4d3ae121a 100644
--- a/include/hw/arm/bcm2835_peripherals.h
+++ b/include/hw/arm/bcm2835_peripherals.h
@@ -33,8 +33,8 @@
#define TYPE_BCM2835_PERIPHERALS "bcm2835-peripherals"
typedef struct BCM2835PeripheralState BCM2835PeripheralState;
-#define BCM2835_PERIPHERALS(obj) \
- OBJECT_CHECK(BCM2835PeripheralState, (obj), TYPE_BCM2835_PERIPHERALS)
+DECLARE_INSTANCE_CHECKER(BCM2835PeripheralState, BCM2835_PERIPHERALS,
+ TYPE_BCM2835_PERIPHERALS)
struct BCM2835PeripheralState {
/*< private >*/
diff --git a/include/hw/arm/bcm2836.h b/include/hw/arm/bcm2836.h
index cf22dc96a0..181d9563d0 100644
--- a/include/hw/arm/bcm2836.h
+++ b/include/hw/arm/bcm2836.h
@@ -20,7 +20,8 @@
#define TYPE_BCM283X "bcm283x"
typedef struct BCM283XClass BCM283XClass;
typedef struct BCM283XState BCM283XState;
-#define BCM283X(obj) OBJECT_CHECK(BCM283XState, (obj), TYPE_BCM283X)
+DECLARE_OBJ_CHECKERS(BCM283XState, BCM283XClass,
+ BCM283X, TYPE_BCM283X)
#define BCM283X_NCPUS 4
@@ -52,9 +53,5 @@ struct BCM283XClass {
const BCM283XInfo *info;
};
-#define BCM283X_CLASS(klass) \
- OBJECT_CLASS_CHECK(BCM283XClass, (klass), TYPE_BCM283X)
-#define BCM283X_GET_CLASS(obj) \
- OBJECT_GET_CLASS(BCM283XClass, (obj), TYPE_BCM283X)
#endif /* BCM2836_H */
diff --git a/include/hw/arm/digic.h b/include/hw/arm/digic.h
index f77833f6e3..f3ba398914 100644
--- a/include/hw/arm/digic.h
+++ b/include/hw/arm/digic.h
@@ -26,7 +26,8 @@
#define TYPE_DIGIC "digic"
typedef struct DigicState DigicState;
-#define DIGIC(obj) OBJECT_CHECK(DigicState, (obj), TYPE_DIGIC)
+DECLARE_INSTANCE_CHECKER(DigicState, DIGIC,
+ TYPE_DIGIC)
#define DIGIC4_NB_TIMERS 3
diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
index 114c594cd2..c2de1dc102 100644
--- a/include/hw/arm/exynos4210.h
+++ b/include/hw/arm/exynos4210.h
@@ -106,8 +106,8 @@ struct Exynos4210State {
typedef struct Exynos4210State Exynos4210State;
#define TYPE_EXYNOS4210_SOC "exynos4210"
-#define EXYNOS4210_SOC(obj) \
- OBJECT_CHECK(Exynos4210State, obj, TYPE_EXYNOS4210_SOC)
+DECLARE_INSTANCE_CHECKER(Exynos4210State, EXYNOS4210_SOC,
+ TYPE_EXYNOS4210_SOC)
void exynos4210_write_secondary(ARMCPU *cpu,
const struct arm_boot_info *info);
diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h
index 8b4c974f09..e239505724 100644
--- a/include/hw/arm/fsl-imx25.h
+++ b/include/hw/arm/fsl-imx25.h
@@ -36,7 +36,8 @@
#define TYPE_FSL_IMX25 "fsl,imx25"
typedef struct FslIMX25State FslIMX25State;
-#define FSL_IMX25(obj) OBJECT_CHECK(FslIMX25State, (obj), TYPE_FSL_IMX25)
+DECLARE_INSTANCE_CHECKER(FslIMX25State, FSL_IMX25,
+ TYPE_FSL_IMX25)
#define FSL_IMX25_NUM_UARTS 5
#define FSL_IMX25_NUM_GPTS 4
diff --git a/include/hw/arm/fsl-imx31.h b/include/hw/arm/fsl-imx31.h
index 12368f2c8f..64b4ca07b7 100644
--- a/include/hw/arm/fsl-imx31.h
+++ b/include/hw/arm/fsl-imx31.h
@@ -32,7 +32,8 @@
#define TYPE_FSL_IMX31 "fsl,imx31"
typedef struct FslIMX31State FslIMX31State;
-#define FSL_IMX31(obj) OBJECT_CHECK(FslIMX31State, (obj), TYPE_FSL_IMX31)
+DECLARE_INSTANCE_CHECKER(FslIMX31State, FSL_IMX31,
+ TYPE_FSL_IMX31)
#define FSL_IMX31_NUM_UARTS 2
#define FSL_IMX31_NUM_EPITS 2
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
index e66ea1e917..602b9aff36 100644
--- a/include/hw/arm/fsl-imx6.h
+++ b/include/hw/arm/fsl-imx6.h
@@ -38,7 +38,8 @@
#define TYPE_FSL_IMX6 "fsl,imx6"
typedef struct FslIMX6State FslIMX6State;
-#define FSL_IMX6(obj) OBJECT_CHECK(FslIMX6State, (obj), TYPE_FSL_IMX6)
+DECLARE_INSTANCE_CHECKER(FslIMX6State, FSL_IMX6,
+ TYPE_FSL_IMX6)
#define FSL_IMX6_NUM_CPUS 4
#define FSL_IMX6_NUM_UARTS 5
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
index e95c4820c6..e4862fdb2c 100644
--- a/include/hw/arm/fsl-imx6ul.h
+++ b/include/hw/arm/fsl-imx6ul.h
@@ -42,7 +42,8 @@
#define TYPE_FSL_IMX6UL "fsl,imx6ul"
typedef struct FslIMX6ULState FslIMX6ULState;
-#define FSL_IMX6UL(obj) OBJECT_CHECK(FslIMX6ULState, (obj), TYPE_FSL_IMX6UL)
+DECLARE_INSTANCE_CHECKER(FslIMX6ULState, FSL_IMX6UL,
+ TYPE_FSL_IMX6UL)
enum FslIMX6ULConfiguration {
FSL_IMX6UL_NUM_CPUS = 1,
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
index 8095e5544b..434d1d0641 100644
--- a/include/hw/arm/fsl-imx7.h
+++ b/include/hw/arm/fsl-imx7.h
@@ -43,7 +43,8 @@
#define TYPE_FSL_IMX7 "fsl,imx7"
typedef struct FslIMX7State FslIMX7State;
-#define FSL_IMX7(obj) OBJECT_CHECK(FslIMX7State, (obj), TYPE_FSL_IMX7)
+DECLARE_INSTANCE_CHECKER(FslIMX7State, FSL_IMX7,
+ TYPE_FSL_IMX7)
enum FslIMX7Configuration {
FSL_IMX7_NUM_CPUS = 2,
diff --git a/include/hw/arm/linux-boot-if.h b/include/hw/arm/linux-boot-if.h
index 6d9e13fd36..c85f33b2c5 100644
--- a/include/hw/arm/linux-boot-if.h
+++ b/include/hw/arm/linux-boot-if.h
@@ -10,10 +10,8 @@
#define TYPE_ARM_LINUX_BOOT_IF "arm-linux-boot-if"
typedef struct ARMLinuxBootIfClass ARMLinuxBootIfClass;
-#define ARM_LINUX_BOOT_IF_CLASS(klass) \
- OBJECT_CLASS_CHECK(ARMLinuxBootIfClass, (klass), TYPE_ARM_LINUX_BOOT_IF)
-#define ARM_LINUX_BOOT_IF_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ARMLinuxBootIfClass, (obj), TYPE_ARM_LINUX_BOOT_IF)
+DECLARE_CLASS_CHECKERS(ARMLinuxBootIfClass, ARM_LINUX_BOOT_IF,
+ TYPE_ARM_LINUX_BOOT_IF)
#define ARM_LINUX_BOOT_IF(obj) \
INTERFACE_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF)
diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h
index b4bc5ef96a..9b93d0d64e 100644
--- a/include/hw/arm/msf2-soc.h
+++ b/include/hw/arm/msf2-soc.h
@@ -34,7 +34,8 @@
#define TYPE_MSF2_SOC "msf2-soc"
typedef struct MSF2State MSF2State;
-#define MSF2_SOC(obj) OBJECT_CHECK(MSF2State, (obj), TYPE_MSF2_SOC)
+DECLARE_INSTANCE_CHECKER(MSF2State, MSF2_SOC,
+ TYPE_MSF2_SOC)
#define MSF2_NUM_SPIS 2
#define MSF2_NUM_UARTS 2
diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
index 727ac1ae04..b69492b29d 100644
--- a/include/hw/arm/nrf51_soc.h
+++ b/include/hw/arm/nrf51_soc.h
@@ -21,8 +21,8 @@
#define TYPE_NRF51_SOC "nrf51-soc"
typedef struct NRF51State NRF51State;
-#define NRF51_SOC(obj) \
- OBJECT_CHECK(NRF51State, (obj), TYPE_NRF51_SOC)
+DECLARE_INSTANCE_CHECKER(NRF51State, NRF51_SOC,
+ TYPE_NRF51_SOC)
#define NRF51_NUM_TIMERS 3
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index 0d365edeec..0dbf1712f4 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -71,8 +71,8 @@ void omap_clk_reparent(omap_clk clk, omap_clk parent);
/* omap_intc.c */
#define TYPE_OMAP_INTC "common-omap-intc"
typedef struct omap_intr_handler_s omap_intr_handler;
-#define OMAP_INTC(obj) \
- OBJECT_CHECK(omap_intr_handler, (obj), TYPE_OMAP_INTC)
+DECLARE_INSTANCE_CHECKER(omap_intr_handler, OMAP_INTC,
+ TYPE_OMAP_INTC)
/*
@@ -95,7 +95,8 @@ void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk);
/* omap_i2c.c */
#define TYPE_OMAP_I2C "omap_i2c"
typedef struct OMAPI2CState OMAPI2CState;
-#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
+DECLARE_INSTANCE_CHECKER(OMAPI2CState, OMAP_I2C,
+ TYPE_OMAP_I2C)
/* TODO: clock framework (see above) */
@@ -104,12 +105,12 @@ void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk);
/* omap_gpio.c */
#define TYPE_OMAP1_GPIO "omap-gpio"
-#define OMAP1_GPIO(obj) \
- OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO)
+DECLARE_INSTANCE_CHECKER(struct omap_gpif_s, OMAP1_GPIO,
+ TYPE_OMAP1_GPIO)
#define TYPE_OMAP2_GPIO "omap2-gpio"
-#define OMAP2_GPIO(obj) \
- OBJECT_CHECK(struct omap2_gpif_s, (obj), TYPE_OMAP2_GPIO)
+DECLARE_INSTANCE_CHECKER(struct omap2_gpif_s, OMAP2_GPIO,
+ TYPE_OMAP2_GPIO)
typedef struct omap_gpif_s omap_gpif;
typedef struct omap2_gpif_s omap2_gpif;
diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h
index b2f9a41468..9046876134 100644
--- a/include/hw/arm/pxa.h
+++ b/include/hw/arm/pxa.h
@@ -89,7 +89,8 @@ void pxa2xx_lcd_vsync_notifier(PXA2xxLCDState *s, qemu_irq handler);
/* pxa2xx_mmci.c */
#define TYPE_PXA2XX_MMCI "pxa2xx-mmci"
typedef struct PXA2xxMMCIState PXA2xxMMCIState;
-#define PXA2XX_MMCI(obj) OBJECT_CHECK(PXA2xxMMCIState, (obj), TYPE_PXA2XX_MMCI)
+DECLARE_INSTANCE_CHECKER(PXA2xxMMCIState, PXA2XX_MMCI,
+ TYPE_PXA2XX_MMCI)
PXA2xxMMCIState *pxa2xx_mmci_init(MemoryRegion *sysmem,
hwaddr base,
@@ -100,8 +101,8 @@ void pxa2xx_mmci_handlers(PXA2xxMMCIState *s, qemu_irq readonly,
/* pxa2xx_pcmcia.c */
#define TYPE_PXA2XX_PCMCIA "pxa2xx-pcmcia"
typedef struct PXA2xxPCMCIAState PXA2xxPCMCIAState;
-#define PXA2XX_PCMCIA(obj) \
- OBJECT_CHECK(PXA2xxPCMCIAState, obj, TYPE_PXA2XX_PCMCIA)
+DECLARE_INSTANCE_CHECKER(PXA2xxPCMCIAState, PXA2XX_PCMCIA,
+ TYPE_PXA2XX_PCMCIA)
PXA2xxPCMCIAState *pxa2xx_pcmcia_init(MemoryRegion *sysmem,
hwaddr base);
@@ -129,12 +130,13 @@ I2CBus *pxa2xx_i2c_bus(PXA2xxI2CState *s);
#define TYPE_PXA2XX_I2C "pxa2xx_i2c"
typedef struct PXA2xxI2SState PXA2xxI2SState;
-#define PXA2XX_I2C(obj) \
- OBJECT_CHECK(PXA2xxI2CState, (obj), TYPE_PXA2XX_I2C)
+DECLARE_INSTANCE_CHECKER(PXA2xxI2CState, PXA2XX_I2C,
+ TYPE_PXA2XX_I2C)
#define TYPE_PXA2XX_FIR "pxa2xx-fir"
typedef struct PXA2xxFIrState PXA2xxFIrState;
-#define PXA2XX_FIR(obj) OBJECT_CHECK(PXA2xxFIrState, (obj), TYPE_PXA2XX_FIR)
+DECLARE_INSTANCE_CHECKER(PXA2xxFIrState, PXA2XX_FIR,
+ TYPE_PXA2XX_FIR)
typedef struct {
ARMCPU *cpu;
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
index b6b51a1cb1..54d0872fd8 100644
--- a/include/hw/arm/smmu-common.h
+++ b/include/hw/arm/smmu-common.h
@@ -132,11 +132,8 @@ struct SMMUBaseClass {
typedef struct SMMUBaseClass SMMUBaseClass;
#define TYPE_ARM_SMMU "arm-smmu"
-#define ARM_SMMU(obj) OBJECT_CHECK(SMMUState, (obj), TYPE_ARM_SMMU)
-#define ARM_SMMU_CLASS(klass) \
- OBJECT_CLASS_CHECK(SMMUBaseClass, (klass), TYPE_ARM_SMMU)
-#define ARM_SMMU_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SMMUBaseClass, (obj), TYPE_ARM_SMMU)
+DECLARE_OBJ_CHECKERS(SMMUState, SMMUBaseClass,
+ ARM_SMMU, TYPE_ARM_SMMU)
/* Return the SMMUPciBus handle associated to a PCI bus number */
SMMUPciBus *smmu_find_smmu_pcibus(SMMUState *s, uint8_t bus_num);
diff --git a/include/hw/arm/smmuv3.h b/include/hw/arm/smmuv3.h
index 698b89d234..2a3f6dd197 100644
--- a/include/hw/arm/smmuv3.h
+++ b/include/hw/arm/smmuv3.h
@@ -83,10 +83,7 @@ struct SMMUv3Class {
typedef struct SMMUv3Class SMMUv3Class;
#define TYPE_ARM_SMMUV3 "arm-smmuv3"
-#define ARM_SMMUV3(obj) OBJECT_CHECK(SMMUv3State, (obj), TYPE_ARM_SMMUV3)
-#define ARM_SMMUV3_CLASS(klass) \
- OBJECT_CLASS_CHECK(SMMUv3Class, (klass), TYPE_ARM_SMMUV3)
-#define ARM_SMMUV3_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SMMUv3Class, (obj), TYPE_ARM_SMMUV3)
+DECLARE_OBJ_CHECKERS(SMMUv3State, SMMUv3Class,
+ ARM_SMMUV3, TYPE_ARM_SMMUV3)
#endif
diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h
index 6d86937e07..9c2f4818a6 100644
--- a/include/hw/arm/stm32f205_soc.h
+++ b/include/hw/arm/stm32f205_soc.h
@@ -36,8 +36,8 @@
#define TYPE_STM32F205_SOC "stm32f205-soc"
typedef struct STM32F205State STM32F205State;
-#define STM32F205_SOC(obj) \
- OBJECT_CHECK(STM32F205State, (obj), TYPE_STM32F205_SOC)
+DECLARE_INSTANCE_CHECKER(STM32F205State, STM32F205_SOC,
+ TYPE_STM32F205_SOC)
#define STM_NUM_USARTS 6
#define STM_NUM_TIMERS 4
diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h
index 8f44fb2046..f1a22763f4 100644
--- a/include/hw/arm/stm32f405_soc.h
+++ b/include/hw/arm/stm32f405_soc.h
@@ -37,8 +37,8 @@
#define TYPE_STM32F405_SOC "stm32f405-soc"
typedef struct STM32F405State STM32F405State;
-#define STM32F405_SOC(obj) \
- OBJECT_CHECK(STM32F405State, (obj), TYPE_STM32F405_SOC)
+DECLARE_INSTANCE_CHECKER(STM32F405State, STM32F405_SOC,
+ TYPE_STM32F405_SOC)
#define STM_NUM_USARTS 7
#define STM_NUM_TIMERS 4
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
index 49ad860943..392b0bd571 100644
--- a/include/hw/arm/virt.h
+++ b/include/hw/arm/virt.h
@@ -170,12 +170,8 @@ typedef struct VirtMachineState VirtMachineState;
#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
#define TYPE_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
-#define VIRT_MACHINE(obj) \
- OBJECT_CHECK(VirtMachineState, (obj), TYPE_VIRT_MACHINE)
-#define VIRT_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtMachineClass, obj, TYPE_VIRT_MACHINE)
-#define VIRT_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE)
+DECLARE_OBJ_CHECKERS(VirtMachineState, VirtMachineClass,
+ VIRT_MACHINE, TYPE_VIRT_MACHINE)
void virt_acpi_setup(VirtMachineState *vms);
bool virt_is_acpi_enabled(VirtMachineState *vms);
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index a960619ec9..eaa9023fd6 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -24,7 +24,8 @@
#define TYPE_XLNX_VERSAL "xlnx-versal"
typedef struct Versal Versal;
-#define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
+DECLARE_INSTANCE_CHECKER(Versal, XLNX_VERSAL,
+ TYPE_XLNX_VERSAL)
#define XLNX_VERSAL_NR_ACPUS 2
#define XLNX_VERSAL_NR_UARTS 2
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
index 6a24216abf..4cc97b4610 100644
--- a/include/hw/arm/xlnx-zynqmp.h
+++ b/include/hw/arm/xlnx-zynqmp.h
@@ -36,8 +36,8 @@
#define TYPE_XLNX_ZYNQMP "xlnx,zynqmp"
typedef struct XlnxZynqMPState XlnxZynqMPState;
-#define XLNX_ZYNQMP(obj) OBJECT_CHECK(XlnxZynqMPState, (obj), \
- TYPE_XLNX_ZYNQMP)
+DECLARE_INSTANCE_CHECKER(XlnxZynqMPState, XLNX_ZYNQMP,
+ TYPE_XLNX_ZYNQMP)
#define XLNX_ZYNQMP_NUM_APU_CPUS 4
#define XLNX_ZYNQMP_NUM_RPU_CPUS 2
diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h
index 9b2fa7e92c..3e26303705 100644
--- a/include/hw/block/flash.h
+++ b/include/hw/block/flash.h
@@ -10,8 +10,8 @@
#define TYPE_PFLASH_CFI01 "cfi.pflash01"
typedef struct PFlashCFI01 PFlashCFI01;
-#define PFLASH_CFI01(obj) \
- OBJECT_CHECK(PFlashCFI01, (obj), TYPE_PFLASH_CFI01)
+DECLARE_INSTANCE_CHECKER(PFlashCFI01, PFLASH_CFI01,
+ TYPE_PFLASH_CFI01)
PFlashCFI01 *pflash_cfi01_register(hwaddr base,
@@ -31,8 +31,8 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *dev, DriveInfo *dinfo);
#define TYPE_PFLASH_CFI02 "cfi.pflash02"
typedef struct PFlashCFI02 PFlashCFI02;
-#define PFLASH_CFI02(obj) \
- OBJECT_CHECK(PFlashCFI02, (obj), TYPE_PFLASH_CFI02)
+DECLARE_INSTANCE_CHECKER(PFlashCFI02, PFLASH_CFI02,
+ TYPE_PFLASH_CFI02)
PFlashCFI02 *pflash_cfi02_register(hwaddr base,
diff --git a/include/hw/block/swim.h b/include/hw/block/swim.h
index f013d634f7..8287da7c30 100644
--- a/include/hw/block/swim.h
+++ b/include/hw/block/swim.h
@@ -22,7 +22,8 @@ typedef struct SWIMBus SWIMBus;
typedef struct SWIMCtrl SWIMCtrl;
#define TYPE_SWIM_DRIVE "swim-drive"
-#define SWIM_DRIVE(obj) OBJECT_CHECK(SWIMDrive, (obj), TYPE_SWIM_DRIVE)
+DECLARE_INSTANCE_CHECKER(SWIMDrive, SWIM_DRIVE,
+ TYPE_SWIM_DRIVE)
struct SWIMDrive {
DeviceState qdev;
@@ -31,7 +32,8 @@ struct SWIMDrive {
};
#define TYPE_SWIM_BUS "swim-bus"
-#define SWIM_BUS(obj) OBJECT_CHECK(SWIMBus, (obj), TYPE_SWIM_BUS)
+DECLARE_INSTANCE_CHECKER(SWIMBus, SWIM_BUS,
+ TYPE_SWIM_BUS)
struct SWIMBus {
BusState bus;
@@ -69,7 +71,8 @@ struct SWIMCtrl {
#define TYPE_SWIM "swim"
typedef struct Swim Swim;
-#define SWIM(obj) OBJECT_CHECK(Swim, (obj), TYPE_SWIM)
+DECLARE_INSTANCE_CHECKER(Swim, SWIM,
+ TYPE_SWIM)
struct Swim {
SysBusDevice parent_obj;
diff --git a/include/hw/boards.h b/include/hw/boards.h
index bc5b82ad20..795910d01b 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -21,12 +21,8 @@
#define TYPE_MACHINE "machine"
#undef MACHINE /* BSD defines it and QEMU does not use it */
-#define MACHINE(obj) \
- OBJECT_CHECK(MachineState, (obj), TYPE_MACHINE)
-#define MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(MachineClass, (obj), TYPE_MACHINE)
-#define MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(MachineClass, (klass), TYPE_MACHINE)
+DECLARE_OBJ_CHECKERS(MachineState, MachineClass,
+ MACHINE, TYPE_MACHINE)
extern MachineState *current_machine;
diff --git a/include/hw/char/avr_usart.h b/include/hw/char/avr_usart.h
index 67ad345edd..5202f152b0 100644
--- a/include/hw/char/avr_usart.h
+++ b/include/hw/char/avr_usart.h
@@ -59,8 +59,8 @@
#define TYPE_AVR_USART "avr-usart"
typedef struct AVRUsartState AVRUsartState;
-#define AVR_USART(obj) \
- OBJECT_CHECK(AVRUsartState, (obj), TYPE_AVR_USART)
+DECLARE_INSTANCE_CHECKER(AVRUsartState, AVR_USART,
+ TYPE_AVR_USART)
struct AVRUsartState {
/* <private> */
diff --git a/include/hw/char/bcm2835_aux.h b/include/hw/char/bcm2835_aux.h
index 2647becc52..a08795c47f 100644
--- a/include/hw/char/bcm2835_aux.h
+++ b/include/hw/char/bcm2835_aux.h
@@ -15,7 +15,8 @@
#define TYPE_BCM2835_AUX "bcm2835-aux"
typedef struct BCM2835AuxState BCM2835AuxState;
-#define BCM2835_AUX(obj) OBJECT_CHECK(BCM2835AuxState, (obj), TYPE_BCM2835_AUX)
+DECLARE_INSTANCE_CHECKER(BCM2835AuxState, BCM2835_AUX,
+ TYPE_BCM2835_AUX)
#define BCM2835_AUX_RX_FIFO_LEN 8
diff --git a/include/hw/char/cadence_uart.h b/include/hw/char/cadence_uart.h
index 3d02d6ef1a..1734f53541 100644
--- a/include/hw/char/cadence_uart.h
+++ b/include/hw/char/cadence_uart.h
@@ -33,8 +33,8 @@
#define TYPE_CADENCE_UART "cadence_uart"
typedef struct CadenceUARTState CadenceUARTState;
-#define CADENCE_UART(obj) OBJECT_CHECK(CadenceUARTState, (obj), \
- TYPE_CADENCE_UART)
+DECLARE_INSTANCE_CHECKER(CadenceUARTState, CADENCE_UART,
+ TYPE_CADENCE_UART)
struct CadenceUARTState {
/*< private >*/
diff --git a/include/hw/char/cmsdk-apb-uart.h b/include/hw/char/cmsdk-apb-uart.h
index 32c0df9df3..2c3869aa16 100644
--- a/include/hw/char/cmsdk-apb-uart.h
+++ b/include/hw/char/cmsdk-apb-uart.h
@@ -19,8 +19,8 @@
#define TYPE_CMSDK_APB_UART "cmsdk-apb-uart"
typedef struct CMSDKAPBUART CMSDKAPBUART;
-#define CMSDK_APB_UART(obj) OBJECT_CHECK(CMSDKAPBUART, (obj), \
- TYPE_CMSDK_APB_UART)
+DECLARE_INSTANCE_CHECKER(CMSDKAPBUART, CMSDK_APB_UART,
+ TYPE_CMSDK_APB_UART)
struct CMSDKAPBUART {
/*< private >*/
diff --git a/include/hw/char/digic-uart.h b/include/hw/char/digic-uart.h
index 7c6ec2a5c5..01d406833d 100644
--- a/include/hw/char/digic-uart.h
+++ b/include/hw/char/digic-uart.h
@@ -24,8 +24,8 @@
#define TYPE_DIGIC_UART "digic-uart"
typedef struct DigicUartState DigicUartState;
-#define DIGIC_UART(obj) \
- OBJECT_CHECK(DigicUartState, (obj), TYPE_DIGIC_UART)
+DECLARE_INSTANCE_CHECKER(DigicUartState, DIGIC_UART,
+ TYPE_DIGIC_UART)
enum {
R_TX = 0x00,
diff --git a/include/hw/char/escc.h b/include/hw/char/escc.h
index 5de2a39e77..5eaec507da 100644
--- a/include/hw/char/escc.h
+++ b/include/hw/char/escc.h
@@ -12,7 +12,8 @@
#define ESCC_SIZE 4
typedef struct ESCCState ESCCState;
-#define ESCC(obj) OBJECT_CHECK(ESCCState, (obj), TYPE_ESCC)
+DECLARE_INSTANCE_CHECKER(ESCCState, ESCC,
+ TYPE_ESCC)
typedef enum {
escc_chn_a, escc_chn_b,
diff --git a/include/hw/char/ibex_uart.h b/include/hw/char/ibex_uart.h
index ec9fcde8f0..36eb75fc4c 100644
--- a/include/hw/char/ibex_uart.h
+++ b/include/hw/char/ibex_uart.h
@@ -71,8 +71,8 @@ REG32(TIMEOUT_CTRL, 0x2c)
#define TYPE_IBEX_UART "ibex-uart"
typedef struct IbexUartState IbexUartState;
-#define IBEX_UART(obj) \
- OBJECT_CHECK(IbexUartState, (obj), TYPE_IBEX_UART)
+DECLARE_INSTANCE_CHECKER(IbexUartState, IBEX_UART,
+ TYPE_IBEX_UART)
struct IbexUartState {
/* <private> */
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
index bfaf8ec695..200f1ec33a 100644
--- a/include/hw/char/imx_serial.h
+++ b/include/hw/char/imx_serial.h
@@ -24,7 +24,8 @@
#define TYPE_IMX_SERIAL "imx.serial"
typedef struct IMXSerialState IMXSerialState;
-#define IMX_SERIAL(obj) OBJECT_CHECK(IMXSerialState, (obj), TYPE_IMX_SERIAL)
+DECLARE_INSTANCE_CHECKER(IMXSerialState, IMX_SERIAL,
+ TYPE_IMX_SERIAL)
#define URXD_CHARRDY (1<<15) /* character read is valid */
#define URXD_ERR (1<<14) /* Character has error */
diff --git a/include/hw/char/nrf51_uart.h b/include/hw/char/nrf51_uart.h
index 20560ba6dc..0cf3c4e328 100644
--- a/include/hw/char/nrf51_uart.h
+++ b/include/hw/char/nrf51_uart.h
@@ -21,7 +21,8 @@
#define TYPE_NRF51_UART "nrf51_soc.uart"
typedef struct NRF51UARTState NRF51UARTState;
-#define NRF51_UART(obj) OBJECT_CHECK(NRF51UARTState, (obj), TYPE_NRF51_UART)
+DECLARE_INSTANCE_CHECKER(NRF51UARTState, NRF51_UART,
+ TYPE_NRF51_UART)
REG32(UART_STARTRX, 0x000)
REG32(UART_STOPRX, 0x004)
diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h
index ddbd8ad45b..80de4ecde6 100644
--- a/include/hw/char/pl011.h
+++ b/include/hw/char/pl011.h
@@ -23,7 +23,8 @@
#define TYPE_PL011 "pl011"
typedef struct PL011State PL011State;
-#define PL011(obj) OBJECT_CHECK(PL011State, (obj), TYPE_PL011)
+DECLARE_INSTANCE_CHECKER(PL011State, PL011,
+ TYPE_PL011)
/* This shares the same struct (and cast macro) as the base pl011 device */
#define TYPE_PL011_LUMINARY "pl011_luminary"
diff --git a/include/hw/char/renesas_sci.h b/include/hw/char/renesas_sci.h
index 5a5ebfd28c..a4764e3eee 100644
--- a/include/hw/char/renesas_sci.h
+++ b/include/hw/char/renesas_sci.h
@@ -15,7 +15,8 @@
#define TYPE_RENESAS_SCI "renesas-sci"
typedef struct RSCIState RSCIState;
-#define RSCI(obj) OBJECT_CHECK(RSCIState, (obj), TYPE_RENESAS_SCI)
+DECLARE_INSTANCE_CHECKER(RSCIState, RSCI,
+ TYPE_RENESAS_SCI)
enum {
ERI = 0,
diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h
index dbeef43676..264f529a7f 100644
--- a/include/hw/char/serial.h
+++ b/include/hw/char/serial.h
@@ -104,13 +104,16 @@ extern const MemoryRegionOps serial_io_ops;
void serial_set_frequency(SerialState *s, uint32_t frequency);
#define TYPE_SERIAL "serial"
-#define SERIAL(s) OBJECT_CHECK(SerialState, (s), TYPE_SERIAL)
+DECLARE_INSTANCE_CHECKER(SerialState, SERIAL,
+ TYPE_SERIAL)
#define TYPE_SERIAL_MM "serial-mm"
-#define SERIAL_MM(s) OBJECT_CHECK(SerialMM, (s), TYPE_SERIAL_MM)
+DECLARE_INSTANCE_CHECKER(SerialMM, SERIAL_MM,
+ TYPE_SERIAL_MM)
#define TYPE_SERIAL_IO "serial-io"
-#define SERIAL_IO(s) OBJECT_CHECK(SerialIO, (s), TYPE_SERIAL_IO)
+DECLARE_INSTANCE_CHECKER(SerialIO, SERIAL_IO,
+ TYPE_SERIAL_IO)
SerialMM *serial_mm_init(MemoryRegion *address_space,
hwaddr base, int regshift,
diff --git a/include/hw/char/stm32f2xx_usart.h b/include/hw/char/stm32f2xx_usart.h
index c44faca751..1670c076d4 100644
--- a/include/hw/char/stm32f2xx_usart.h
+++ b/include/hw/char/stm32f2xx_usart.h
@@ -55,8 +55,8 @@
#define TYPE_STM32F2XX_USART "stm32f2xx-usart"
typedef struct STM32F2XXUsartState STM32F2XXUsartState;
-#define STM32F2XX_USART(obj) \
- OBJECT_CHECK(STM32F2XXUsartState, (obj), TYPE_STM32F2XX_USART)
+DECLARE_INSTANCE_CHECKER(STM32F2XXUsartState, STM32F2XX_USART,
+ TYPE_STM32F2XX_USART)
struct STM32F2XXUsartState {
/* <private> */
diff --git a/include/hw/clock.h b/include/hw/clock.h
index 65cf363dd5..b524509b47 100644
--- a/include/hw/clock.h
+++ b/include/hw/clock.h
@@ -19,7 +19,8 @@
#define TYPE_CLOCK "clock"
typedef struct Clock Clock;
-#define CLOCK(obj) OBJECT_CHECK(Clock, (obj), TYPE_CLOCK)
+DECLARE_INSTANCE_CHECKER(Clock, CLOCK,
+ TYPE_CLOCK)
typedef void ClockCallback(void *opaque);
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index b22bb54c82..99dc33ffeb 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -63,8 +63,8 @@ typedef uint64_t vaddr;
#define CPU(obj) ((CPUState *)(obj))
typedef struct CPUClass CPUClass;
-#define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU)
-#define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU)
+DECLARE_CLASS_CHECKERS(CPUClass, CPU,
+ TYPE_CPU)
typedef enum MMUAccessType {
MMU_DATA_LOAD = 0,
diff --git a/include/hw/core/generic-loader.h b/include/hw/core/generic-loader.h
index f435af1884..8e86532df6 100644
--- a/include/hw/core/generic-loader.h
+++ b/include/hw/core/generic-loader.h
@@ -43,7 +43,7 @@ struct GenericLoaderState {
typedef struct GenericLoaderState GenericLoaderState;
#define TYPE_GENERIC_LOADER "loader"
-#define GENERIC_LOADER(obj) OBJECT_CHECK(GenericLoaderState, (obj), \
- TYPE_GENERIC_LOADER)
+DECLARE_INSTANCE_CHECKER(GenericLoaderState, GENERIC_LOADER,
+ TYPE_GENERIC_LOADER)
#endif
diff --git a/include/hw/core/split-irq.h b/include/hw/core/split-irq.h
index 872a39aa4f..76d42b29aa 100644
--- a/include/hw/core/split-irq.h
+++ b/include/hw/core/split-irq.h
@@ -44,7 +44,8 @@
typedef struct SplitIRQ SplitIRQ;
-#define SPLIT_IRQ(obj) OBJECT_CHECK(SplitIRQ, (obj), TYPE_SPLIT_IRQ)
+DECLARE_INSTANCE_CHECKER(SplitIRQ, SPLIT_IRQ,
+ TYPE_SPLIT_IRQ)
struct SplitIRQ {
DeviceState parent_obj;
diff --git a/include/hw/cpu/a15mpcore.h b/include/hw/cpu/a15mpcore.h
index 01415728d0..58d8ac7415 100644
--- a/include/hw/cpu/a15mpcore.h
+++ b/include/hw/cpu/a15mpcore.h
@@ -28,8 +28,8 @@
#define TYPE_A15MPCORE_PRIV "a15mpcore_priv"
typedef struct A15MPPrivState A15MPPrivState;
-#define A15MPCORE_PRIV(obj) \
- OBJECT_CHECK(A15MPPrivState, (obj), TYPE_A15MPCORE_PRIV)
+DECLARE_INSTANCE_CHECKER(A15MPPrivState, A15MPCORE_PRIV,
+ TYPE_A15MPCORE_PRIV)
struct A15MPPrivState {
/*< private >*/
diff --git a/include/hw/cpu/a9mpcore.h b/include/hw/cpu/a9mpcore.h
index 1a3b32cc4c..37e5cfce08 100644
--- a/include/hw/cpu/a9mpcore.h
+++ b/include/hw/cpu/a9mpcore.h
@@ -19,8 +19,8 @@
#define TYPE_A9MPCORE_PRIV "a9mpcore_priv"
typedef struct A9MPPrivState A9MPPrivState;
-#define A9MPCORE_PRIV(obj) \
- OBJECT_CHECK(A9MPPrivState, (obj), TYPE_A9MPCORE_PRIV)
+DECLARE_INSTANCE_CHECKER(A9MPPrivState, A9MPCORE_PRIV,
+ TYPE_A9MPCORE_PRIV)
struct A9MPPrivState {
/*< private >*/
diff --git a/include/hw/cpu/arm11mpcore.h b/include/hw/cpu/arm11mpcore.h
index 5a5575b86d..411d7e6659 100644
--- a/include/hw/cpu/arm11mpcore.h
+++ b/include/hw/cpu/arm11mpcore.h
@@ -18,8 +18,8 @@
#define TYPE_ARM11MPCORE_PRIV "arm11mpcore_priv"
typedef struct ARM11MPCorePriveState ARM11MPCorePriveState;
-#define ARM11MPCORE_PRIV(obj) \
- OBJECT_CHECK(ARM11MPCorePriveState, (obj), TYPE_ARM11MPCORE_PRIV)
+DECLARE_INSTANCE_CHECKER(ARM11MPCorePriveState, ARM11MPCORE_PRIV,
+ TYPE_ARM11MPCORE_PRIV)
struct ARM11MPCorePriveState {
SysBusDevice parent_obj;
diff --git a/include/hw/cpu/cluster.h b/include/hw/cpu/cluster.h
index faacf9757e..1c807c5902 100644
--- a/include/hw/cpu/cluster.h
+++ b/include/hw/cpu/cluster.h
@@ -56,8 +56,8 @@
#define TYPE_CPU_CLUSTER "cpu-cluster"
typedef struct CPUClusterState CPUClusterState;
-#define CPU_CLUSTER(obj) \
- OBJECT_CHECK(CPUClusterState, (obj), TYPE_CPU_CLUSTER)
+DECLARE_INSTANCE_CHECKER(CPUClusterState, CPU_CLUSTER,
+ TYPE_CPU_CLUSTER)
/*
* This limit is imposed by TCG, which puts the cluster ID into an
diff --git a/include/hw/cpu/core.h b/include/hw/cpu/core.h
index 850191527e..61ea3481f8 100644
--- a/include/hw/cpu/core.h
+++ b/include/hw/cpu/core.h
@@ -15,8 +15,8 @@
#define TYPE_CPU_CORE "cpu-core"
typedef struct CPUCore CPUCore;
-#define CPU_CORE(obj) \
- OBJECT_CHECK(CPUCore, (obj), TYPE_CPU_CORE)
+DECLARE_INSTANCE_CHECKER(CPUCore, CPU_CORE,
+ TYPE_CPU_CORE)
struct CPUCore {
/*< private >*/
diff --git a/include/hw/display/bcm2835_fb.h b/include/hw/display/bcm2835_fb.h
index 5fc4d74a06..226d77a264 100644
--- a/include/hw/display/bcm2835_fb.h
+++ b/include/hw/display/bcm2835_fb.h
@@ -18,7 +18,8 @@
#define TYPE_BCM2835_FB "bcm2835-fb"
typedef struct BCM2835FBState BCM2835FBState;
-#define BCM2835_FB(obj) OBJECT_CHECK(BCM2835FBState, (obj), TYPE_BCM2835_FB)
+DECLARE_INSTANCE_CHECKER(BCM2835FBState, BCM2835_FB,
+ TYPE_BCM2835_FB)
/*
* Configuration information about the fb which the guest can program
diff --git a/include/hw/display/dpcd.h b/include/hw/display/dpcd.h
index 6b96a463a7..09304dd1f6 100644
--- a/include/hw/display/dpcd.h
+++ b/include/hw/display/dpcd.h
@@ -29,7 +29,8 @@
typedef struct DPCDState DPCDState;
#define TYPE_DPCD "dpcd"
-#define DPCD(obj) OBJECT_CHECK(DPCDState, (obj), TYPE_DPCD)
+DECLARE_INSTANCE_CHECKER(DPCDState, DPCD,
+ TYPE_DPCD)
/* DCPD Revision. */
#define DPCD_REVISION 0x00
diff --git a/include/hw/display/i2c-ddc.h b/include/hw/display/i2c-ddc.h
index 8ab50641aa..fbabfea5a9 100644
--- a/include/hw/display/i2c-ddc.h
+++ b/include/hw/display/i2c-ddc.h
@@ -37,6 +37,7 @@ struct I2CDDCState {
typedef struct I2CDDCState I2CDDCState;
#define TYPE_I2CDDC "i2c-ddc"
-#define I2CDDC(obj) OBJECT_CHECK(I2CDDCState, (obj), TYPE_I2CDDC)
+DECLARE_INSTANCE_CHECKER(I2CDDCState, I2CDDC,
+ TYPE_I2CDDC)
#endif /* I2C_DDC_H */
diff --git a/include/hw/display/macfb.h b/include/hw/display/macfb.h
index d330ee9823..0960480b75 100644
--- a/include/hw/display/macfb.h
+++ b/include/hw/display/macfb.h
@@ -33,8 +33,8 @@ typedef struct MacfbState {
#define TYPE_MACFB "sysbus-macfb"
typedef struct MacfbSysBusState MacfbSysBusState;
-#define MACFB(obj) \
- OBJECT_CHECK(MacfbSysBusState, (obj), TYPE_MACFB)
+DECLARE_INSTANCE_CHECKER(MacfbSysBusState, MACFB,
+ TYPE_MACFB)
struct MacfbSysBusState {
SysBusDevice busdev;
@@ -45,10 +45,8 @@ struct MacfbSysBusState {
#define TYPE_NUBUS_MACFB "nubus-macfb"
typedef struct MacfbNubusDeviceClass MacfbNubusDeviceClass;
typedef struct MacfbNubusState MacfbNubusState;
-#define NUBUS_MACFB_CLASS(class) \
- OBJECT_CLASS_CHECK(MacfbNubusDeviceClass, (class), TYPE_NUBUS_MACFB)
-#define NUBUS_MACFB_GET_CLASS(obj) \
- OBJECT_GET_CLASS(MacfbNubusDeviceClass, (obj), TYPE_NUBUS_MACFB)
+DECLARE_OBJ_CHECKERS(MacfbNubusState, MacfbNubusDeviceClass,
+ NUBUS_MACFB, TYPE_NUBUS_MACFB)
struct MacfbNubusDeviceClass {
DeviceClass parent_class;
@@ -56,8 +54,6 @@ struct MacfbNubusDeviceClass {
DeviceRealize parent_realize;
};
-#define NUBUS_MACFB(obj) \
- OBJECT_CHECK(MacfbNubusState, (obj), TYPE_NUBUS_MACFB)
struct MacfbNubusState {
NubusDevice busdev;
diff --git a/include/hw/display/xlnx_dp.h b/include/hw/display/xlnx_dp.h
index f76bde2e77..3b7d9e5a2a 100644
--- a/include/hw/display/xlnx_dp.h
+++ b/include/hw/display/xlnx_dp.h
@@ -106,6 +106,7 @@ struct XlnxDPState {
typedef struct XlnxDPState XlnxDPState;
#define TYPE_XLNX_DP "xlnx.v-dp"
-#define XLNX_DP(obj) OBJECT_CHECK(XlnxDPState, (obj), TYPE_XLNX_DP)
+DECLARE_INSTANCE_CHECKER(XlnxDPState, XLNX_DP,
+ TYPE_XLNX_DP)
#endif
diff --git a/include/hw/dma/bcm2835_dma.h b/include/hw/dma/bcm2835_dma.h
index 31f335ec5b..b94dae779a 100644
--- a/include/hw/dma/bcm2835_dma.h
+++ b/include/hw/dma/bcm2835_dma.h
@@ -27,8 +27,8 @@ typedef struct {
#define TYPE_BCM2835_DMA "bcm2835-dma"
typedef struct BCM2835DMAState BCM2835DMAState;
-#define BCM2835_DMA(obj) \
- OBJECT_CHECK(BCM2835DMAState, (obj), TYPE_BCM2835_DMA)
+DECLARE_INSTANCE_CHECKER(BCM2835DMAState, BCM2835_DMA,
+ TYPE_BCM2835_DMA)
#define BCM2835_DMA_NCHANS 16
diff --git a/include/hw/dma/i8257.h b/include/hw/dma/i8257.h
index 46eef1f581..362ce7b8dc 100644
--- a/include/hw/dma/i8257.h
+++ b/include/hw/dma/i8257.h
@@ -7,8 +7,8 @@
#define TYPE_I8257 "i8257"
typedef struct I8257State I8257State;
-#define I8257(obj) \
- OBJECT_CHECK(I8257State, (obj), TYPE_I8257)
+DECLARE_INSTANCE_CHECKER(I8257State, I8257,
+ TYPE_I8257)
typedef struct I8257Regs {
int now[2];
diff --git a/include/hw/dma/pl080.h b/include/hw/dma/pl080.h
index 55a645b055..e9669bf5ae 100644
--- a/include/hw/dma/pl080.h
+++ b/include/hw/dma/pl080.h
@@ -44,7 +44,8 @@ typedef struct {
#define TYPE_PL080 "pl080"
#define TYPE_PL081 "pl081"
typedef struct PL080State PL080State;
-#define PL080(obj) OBJECT_CHECK(PL080State, (obj), TYPE_PL080)
+DECLARE_INSTANCE_CHECKER(PL080State, PL080,
+ TYPE_PL080)
struct PL080State {
SysBusDevice parent_obj;
diff --git a/include/hw/dma/xlnx-zdma.h b/include/hw/dma/xlnx-zdma.h
index 8be9ee5cc2..f638abe568 100644
--- a/include/hw/dma/xlnx-zdma.h
+++ b/include/hw/dma/xlnx-zdma.h
@@ -80,7 +80,7 @@ typedef struct XlnxZDMA XlnxZDMA;
#define TYPE_XLNX_ZDMA "xlnx.zdma"
-#define XLNX_ZDMA(obj) \
- OBJECT_CHECK(XlnxZDMA, (obj), TYPE_XLNX_ZDMA)
+DECLARE_INSTANCE_CHECKER(XlnxZDMA, XLNX_ZDMA,
+ TYPE_XLNX_ZDMA)
#endif /* XLNX_ZDMA_H */
diff --git a/include/hw/dma/xlnx-zynq-devcfg.h b/include/hw/dma/xlnx-zynq-devcfg.h
index 52ba61b653..e16b08f9c5 100644
--- a/include/hw/dma/xlnx-zynq-devcfg.h
+++ b/include/hw/dma/xlnx-zynq-devcfg.h
@@ -34,8 +34,8 @@
#define TYPE_XLNX_ZYNQ_DEVCFG "xlnx.ps7-dev-cfg"
typedef struct XlnxZynqDevcfg XlnxZynqDevcfg;
-#define XLNX_ZYNQ_DEVCFG(obj) \
- OBJECT_CHECK(XlnxZynqDevcfg, (obj), TYPE_XLNX_ZYNQ_DEVCFG)
+DECLARE_INSTANCE_CHECKER(XlnxZynqDevcfg, XLNX_ZYNQ_DEVCFG,
+ TYPE_XLNX_ZYNQ_DEVCFG)
#define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4)
diff --git a/include/hw/dma/xlnx_dpdma.h b/include/hw/dma/xlnx_dpdma.h
index 50952dd7ce..94b01cad0a 100644
--- a/include/hw/dma/xlnx_dpdma.h
+++ b/include/hw/dma/xlnx_dpdma.h
@@ -46,7 +46,8 @@ struct XlnxDPDMAState {
typedef struct XlnxDPDMAState XlnxDPDMAState;
#define TYPE_XLNX_DPDMA "xlnx.dpdma"
-#define XLNX_DPDMA(obj) OBJECT_CHECK(XlnxDPDMAState, (obj), TYPE_XLNX_DPDMA)
+DECLARE_INSTANCE_CHECKER(XlnxDPDMAState, XLNX_DPDMA,
+ TYPE_XLNX_DPDMA)
/*
* xlnx_dpdma_start_operation: Start the operation on the specified channel. The
diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h
index 1231cca63b..8e1d45651c 100644
--- a/include/hw/fw-path-provider.h
+++ b/include/hw/fw-path-provider.h
@@ -23,10 +23,8 @@
#define TYPE_FW_PATH_PROVIDER "fw-path-provider"
typedef struct FWPathProviderClass FWPathProviderClass;
-#define FW_PATH_PROVIDER_CLASS(klass) \
- OBJECT_CLASS_CHECK(FWPathProviderClass, (klass), TYPE_FW_PATH_PROVIDER)
-#define FW_PATH_PROVIDER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(FWPathProviderClass, (obj), TYPE_FW_PATH_PROVIDER)
+DECLARE_CLASS_CHECKERS(FWPathProviderClass, FW_PATH_PROVIDER,
+ TYPE_FW_PATH_PROVIDER)
#define FW_PATH_PROVIDER(obj) \
INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
diff --git a/include/hw/gpio/aspeed_gpio.h b/include/hw/gpio/aspeed_gpio.h
index 4dc0bc3f3d..2582e6e0dc 100644
--- a/include/hw/gpio/aspeed_gpio.h
+++ b/include/hw/gpio/aspeed_gpio.h
@@ -16,11 +16,8 @@
#define TYPE_ASPEED_GPIO "aspeed.gpio"
typedef struct AspeedGPIOClass AspeedGPIOClass;
typedef struct AspeedGPIOState AspeedGPIOState;
-#define ASPEED_GPIO(obj) OBJECT_CHECK(AspeedGPIOState, (obj), TYPE_ASPEED_GPIO)
-#define ASPEED_GPIO_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedGPIOClass, (klass), TYPE_ASPEED_GPIO)
-#define ASPEED_GPIO_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedGPIOClass, (obj), TYPE_ASPEED_GPIO)
+DECLARE_OBJ_CHECKERS(AspeedGPIOState, AspeedGPIOClass,
+ ASPEED_GPIO, TYPE_ASPEED_GPIO)
#define ASPEED_GPIO_MAX_NR_SETS 8
#define ASPEED_REGS_PER_BANK 14
diff --git a/include/hw/gpio/bcm2835_gpio.h b/include/hw/gpio/bcm2835_gpio.h
index d8268f1461..e06e08a0fe 100644
--- a/include/hw/gpio/bcm2835_gpio.h
+++ b/include/hw/gpio/bcm2835_gpio.h
@@ -36,7 +36,7 @@ struct BCM2835GpioState {
typedef struct BCM2835GpioState BCM2835GpioState;
#define TYPE_BCM2835_GPIO "bcm2835_gpio"
-#define BCM2835_GPIO(obj) \
- OBJECT_CHECK(BCM2835GpioState, (obj), TYPE_BCM2835_GPIO)
+DECLARE_INSTANCE_CHECKER(BCM2835GpioState, BCM2835_GPIO,
+ TYPE_BCM2835_GPIO)
#endif
diff --git a/include/hw/gpio/imx_gpio.h b/include/hw/gpio/imx_gpio.h
index b7dc689f73..a72b272ace 100644
--- a/include/hw/gpio/imx_gpio.h
+++ b/include/hw/gpio/imx_gpio.h
@@ -25,7 +25,8 @@
#define TYPE_IMX_GPIO "imx.gpio"
typedef struct IMXGPIOState IMXGPIOState;
-#define IMX_GPIO(obj) OBJECT_CHECK(IMXGPIOState, (obj), TYPE_IMX_GPIO)
+DECLARE_INSTANCE_CHECKER(IMXGPIOState, IMX_GPIO,
+ TYPE_IMX_GPIO)
#define IMX_GPIO_MEM_SIZE 0x20
diff --git a/include/hw/gpio/nrf51_gpio.h b/include/hw/gpio/nrf51_gpio.h
index 0c37dd74c0..55d7d24a52 100644
--- a/include/hw/gpio/nrf51_gpio.h
+++ b/include/hw/gpio/nrf51_gpio.h
@@ -30,7 +30,8 @@
#include "qom/object.h"
#define TYPE_NRF51_GPIO "nrf51_soc.gpio"
typedef struct NRF51GPIOState NRF51GPIOState;
-#define NRF51_GPIO(obj) OBJECT_CHECK(NRF51GPIOState, (obj), TYPE_NRF51_GPIO)
+DECLARE_INSTANCE_CHECKER(NRF51GPIOState, NRF51_GPIO,
+ TYPE_NRF51_GPIO)
#define NRF51_GPIO_PINS 32
diff --git a/include/hw/hotplug.h b/include/hw/hotplug.h
index 6536bb01a3..e15f59c8b3 100644
--- a/include/hw/hotplug.h
+++ b/include/hw/hotplug.h
@@ -17,10 +17,8 @@
#define TYPE_HOTPLUG_HANDLER "hotplug-handler"
typedef struct HotplugHandlerClass HotplugHandlerClass;
-#define HOTPLUG_HANDLER_CLASS(klass) \
- OBJECT_CLASS_CHECK(HotplugHandlerClass, (klass), TYPE_HOTPLUG_HANDLER)
-#define HOTPLUG_HANDLER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(HotplugHandlerClass, (obj), TYPE_HOTPLUG_HANDLER)
+DECLARE_CLASS_CHECKERS(HotplugHandlerClass, HOTPLUG_HANDLER,
+ TYPE_HOTPLUG_HANDLER)
#define HOTPLUG_HANDLER(obj) \
INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER)
diff --git a/include/hw/hyperv/vmbus-bridge.h b/include/hw/hyperv/vmbus-bridge.h
index d090d46651..1324873775 100644
--- a/include/hw/hyperv/vmbus-bridge.h
+++ b/include/hw/hyperv/vmbus-bridge.h
@@ -25,7 +25,8 @@ struct VMBusBridge {
};
typedef struct VMBusBridge VMBusBridge;
-#define VMBUS_BRIDGE(obj) OBJECT_CHECK(VMBusBridge, (obj), TYPE_VMBUS_BRIDGE)
+DECLARE_INSTANCE_CHECKER(VMBusBridge, VMBUS_BRIDGE,
+ TYPE_VMBUS_BRIDGE)
static inline VMBusBridge *vmbus_bridge_find(void)
{
diff --git a/include/hw/hyperv/vmbus.h b/include/hw/hyperv/vmbus.h
index 282399b8ce..0fe3d3b47c 100644
--- a/include/hw/hyperv/vmbus.h
+++ b/include/hw/hyperv/vmbus.h
@@ -22,16 +22,13 @@
typedef struct VMBusDevice VMBusDevice;
typedef struct VMBusDeviceClass VMBusDeviceClass;
-#define VMBUS_DEVICE(obj) \
- OBJECT_CHECK(VMBusDevice, (obj), TYPE_VMBUS_DEVICE)
-#define VMBUS_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VMBusDeviceClass, (klass), TYPE_VMBUS_DEVICE)
-#define VMBUS_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VMBusDeviceClass, (obj), TYPE_VMBUS_DEVICE)
+DECLARE_OBJ_CHECKERS(VMBusDevice, VMBusDeviceClass,
+ VMBUS_DEVICE, TYPE_VMBUS_DEVICE)
#define TYPE_VMBUS "vmbus"
typedef struct VMBus VMBus;
-#define VMBUS(obj) OBJECT_CHECK(VMBus, (obj), TYPE_VMBUS)
+DECLARE_INSTANCE_CHECKER(VMBus, VMBUS,
+ TYPE_VMBUS)
/*
* Object wrapping a GPADL -- GPA Descriptor List -- an array of guest physical
diff --git a/include/hw/i2c/arm_sbcon_i2c.h b/include/hw/i2c/arm_sbcon_i2c.h
index ca54867964..ad96781e7a 100644
--- a/include/hw/i2c/arm_sbcon_i2c.h
+++ b/include/hw/i2c/arm_sbcon_i2c.h
@@ -20,8 +20,8 @@
#define TYPE_ARM_SBCON_I2C TYPE_VERSATILE_I2C
typedef struct ArmSbconI2CState ArmSbconI2CState;
-#define ARM_SBCON_I2C(obj) \
- OBJECT_CHECK(ArmSbconI2CState, (obj), TYPE_ARM_SBCON_I2C)
+DECLARE_INSTANCE_CHECKER(ArmSbconI2CState, ARM_SBCON_I2C,
+ TYPE_ARM_SBCON_I2C)
struct ArmSbconI2CState {
/*< private >*/
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index 2c0198e314..695e1c0928 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -31,8 +31,8 @@
#define TYPE_ASPEED_2600_I2C TYPE_ASPEED_I2C "-ast2600"
typedef struct AspeedI2CClass AspeedI2CClass;
typedef struct AspeedI2CState AspeedI2CState;
-#define ASPEED_I2C(obj) \
- OBJECT_CHECK(AspeedI2CState, (obj), TYPE_ASPEED_I2C)
+DECLARE_OBJ_CHECKERS(AspeedI2CState, AspeedI2CClass,
+ ASPEED_I2C, TYPE_ASPEED_I2C)
#define ASPEED_I2C_NR_BUSSES 16
#define ASPEED_I2C_MAX_POOL_SIZE 0x800
@@ -75,10 +75,6 @@ struct AspeedI2CState {
AddressSpace dram_as;
};
-#define ASPEED_I2C_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedI2CClass, (klass), TYPE_ASPEED_I2C)
-#define ASPEED_I2C_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedI2CClass, (obj), TYPE_ASPEED_I2C)
struct AspeedI2CClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index a22f861451..2074f7c971 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -20,12 +20,8 @@ typedef struct I2CSlave I2CSlave;
#define TYPE_I2C_SLAVE "i2c-slave"
typedef struct I2CSlaveClass I2CSlaveClass;
-#define I2C_SLAVE(obj) \
- OBJECT_CHECK(I2CSlave, (obj), TYPE_I2C_SLAVE)
-#define I2C_SLAVE_CLASS(klass) \
- OBJECT_CLASS_CHECK(I2CSlaveClass, (klass), TYPE_I2C_SLAVE)
-#define I2C_SLAVE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(I2CSlaveClass, (obj), TYPE_I2C_SLAVE)
+DECLARE_OBJ_CHECKERS(I2CSlave, I2CSlaveClass,
+ I2C_SLAVE, TYPE_I2C_SLAVE)
struct I2CSlaveClass {
DeviceClass parent_class;
@@ -55,7 +51,8 @@ struct I2CSlave {
};
#define TYPE_I2C_BUS "i2c-bus"
-#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS)
+DECLARE_INSTANCE_CHECKER(I2CBus, I2C_BUS,
+ TYPE_I2C_BUS)
typedef struct I2CNode I2CNode;
diff --git a/include/hw/i2c/imx_i2c.h b/include/hw/i2c/imx_i2c.h
index 285a8f40a4..e7f09104cf 100644
--- a/include/hw/i2c/imx_i2c.h
+++ b/include/hw/i2c/imx_i2c.h
@@ -26,7 +26,8 @@
#define TYPE_IMX_I2C "imx.i2c"
typedef struct IMXI2CState IMXI2CState;
-#define IMX_I2C(obj) OBJECT_CHECK(IMXI2CState, (obj), TYPE_IMX_I2C)
+DECLARE_INSTANCE_CHECKER(IMXI2CState, IMX_I2C,
+ TYPE_IMX_I2C)
#define IMX_I2C_MEM_SIZE 0x14
diff --git a/include/hw/i2c/microbit_i2c.h b/include/hw/i2c/microbit_i2c.h
index 76ffaff47a..69d70287d7 100644
--- a/include/hw/i2c/microbit_i2c.h
+++ b/include/hw/i2c/microbit_i2c.h
@@ -28,8 +28,8 @@
#define TYPE_MICROBIT_I2C "microbit.i2c"
typedef struct MicrobitI2CState MicrobitI2CState;
-#define MICROBIT_I2C(obj) \
- OBJECT_CHECK(MicrobitI2CState, (obj), TYPE_MICROBIT_I2C)
+DECLARE_INSTANCE_CHECKER(MicrobitI2CState, MICROBIT_I2C,
+ TYPE_MICROBIT_I2C)
#define MICROBIT_I2C_NREGS (NRF51_PERIPHERAL_SIZE / sizeof(uint32_t))
diff --git a/include/hw/i2c/ppc4xx_i2c.h b/include/hw/i2c/ppc4xx_i2c.h
index 3698e054b1..7cbcdaf12f 100644
--- a/include/hw/i2c/ppc4xx_i2c.h
+++ b/include/hw/i2c/ppc4xx_i2c.h
@@ -33,7 +33,8 @@
#define TYPE_PPC4xx_I2C "ppc4xx-i2c"
typedef struct PPC4xxI2CState PPC4xxI2CState;
-#define PPC4xx_I2C(obj) OBJECT_CHECK(PPC4xxI2CState, (obj), TYPE_PPC4xx_I2C)
+DECLARE_INSTANCE_CHECKER(PPC4xxI2CState, PPC4xx_I2C,
+ TYPE_PPC4xx_I2C)
struct PPC4xxI2CState {
/*< private >*/
diff --git a/include/hw/i2c/smbus_slave.h b/include/hw/i2c/smbus_slave.h
index 17f2cd2d8d..8d16e4bcd9 100644
--- a/include/hw/i2c/smbus_slave.h
+++ b/include/hw/i2c/smbus_slave.h
@@ -31,12 +31,8 @@
#define TYPE_SMBUS_DEVICE "smbus-device"
typedef struct SMBusDevice SMBusDevice;
typedef struct SMBusDeviceClass SMBusDeviceClass;
-#define SMBUS_DEVICE(obj) \
- OBJECT_CHECK(SMBusDevice, (obj), TYPE_SMBUS_DEVICE)
-#define SMBUS_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SMBusDeviceClass, (klass), TYPE_SMBUS_DEVICE)
-#define SMBUS_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SMBusDeviceClass, (obj), TYPE_SMBUS_DEVICE)
+DECLARE_OBJ_CHECKERS(SMBusDevice, SMBusDeviceClass,
+ SMBUS_DEVICE, TYPE_SMBUS_DEVICE)
struct SMBusDeviceClass {
diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h
index 124f1fad6f..da38541627 100644
--- a/include/hw/i386/apic_internal.h
+++ b/include/hw/i386/apic_internal.h
@@ -127,12 +127,8 @@ typedef struct APICCommonState APICCommonState;
#define TYPE_APIC_COMMON "apic-common"
typedef struct APICCommonClass APICCommonClass;
-#define APIC_COMMON(obj) \
- OBJECT_CHECK(APICCommonState, (obj), TYPE_APIC_COMMON)
-#define APIC_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(APICCommonClass, (klass), TYPE_APIC_COMMON)
-#define APIC_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(APICCommonClass, (obj), TYPE_APIC_COMMON)
+DECLARE_OBJ_CHECKERS(APICCommonState, APICCommonClass,
+ APIC_COMMON, TYPE_APIC_COMMON)
struct APICCommonClass {
DeviceClass parent_class;
diff --git a/include/hw/i386/ich9.h b/include/hw/i386/ich9.h
index 8fdac227f2..e750d67975 100644
--- a/include/hw/i386/ich9.h
+++ b/include/hw/i386/ich9.h
@@ -25,8 +25,8 @@ void ich9_generate_smi(void);
#define TYPE_ICH9_LPC_DEVICE "ICH9-LPC"
typedef struct ICH9LPCState ICH9LPCState;
-#define ICH9_LPC_DEVICE(obj) \
- OBJECT_CHECK(ICH9LPCState, (obj), TYPE_ICH9_LPC_DEVICE)
+DECLARE_INSTANCE_CHECKER(ICH9LPCState, ICH9_LPC_DEVICE,
+ TYPE_ICH9_LPC_DEVICE)
struct ICH9LPCState {
/* ICH9 LPC PCI to ISA bridge */
diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h
index 53e5d32d54..98cfc77723 100644
--- a/include/hw/i386/intel_iommu.h
+++ b/include/hw/i386/intel_iommu.h
@@ -28,8 +28,8 @@
#define TYPE_INTEL_IOMMU_DEVICE "intel-iommu"
typedef struct IntelIOMMUState IntelIOMMUState;
-#define INTEL_IOMMU_DEVICE(obj) \
- OBJECT_CHECK(IntelIOMMUState, (obj), TYPE_INTEL_IOMMU_DEVICE)
+DECLARE_INSTANCE_CHECKER(IntelIOMMUState, INTEL_IOMMU_DEVICE,
+ TYPE_INTEL_IOMMU_DEVICE)
#define TYPE_INTEL_IOMMU_MEMORY_REGION "intel-iommu-iommu-memory-region"
diff --git a/include/hw/i386/ioapic_internal.h b/include/hw/i386/ioapic_internal.h
index 29ae150727..e9cc2eaf54 100644
--- a/include/hw/i386/ioapic_internal.h
+++ b/include/hw/i386/ioapic_internal.h
@@ -86,12 +86,8 @@ typedef struct IOAPICCommonState IOAPICCommonState;
#define TYPE_IOAPIC_COMMON "ioapic-common"
typedef struct IOAPICCommonClass IOAPICCommonClass;
-#define IOAPIC_COMMON(obj) \
- OBJECT_CHECK(IOAPICCommonState, (obj), TYPE_IOAPIC_COMMON)
-#define IOAPIC_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(IOAPICCommonClass, (klass), TYPE_IOAPIC_COMMON)
-#define IOAPIC_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IOAPICCommonClass, (obj), TYPE_IOAPIC_COMMON)
+DECLARE_OBJ_CHECKERS(IOAPICCommonState, IOAPICCommonClass,
+ IOAPIC_COMMON, TYPE_IOAPIC_COMMON)
struct IOAPICCommonClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/i386/microvm.h b/include/hw/i386/microvm.h
index 0556f64206..36dbcdd123 100644
--- a/include/hw/i386/microvm.h
+++ b/include/hw/i386/microvm.h
@@ -64,11 +64,7 @@ struct MicrovmMachineState {
typedef struct MicrovmMachineState MicrovmMachineState;
#define TYPE_MICROVM_MACHINE MACHINE_TYPE_NAME("microvm")
-#define MICROVM_MACHINE(obj) \
- OBJECT_CHECK(MicrovmMachineState, (obj), TYPE_MICROVM_MACHINE)
-#define MICROVM_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(MicrovmMachineClass, obj, TYPE_MICROVM_MACHINE)
-#define MICROVM_MACHINE_CLASS(class) \
- OBJECT_CLASS_CHECK(MicrovmMachineClass, class, TYPE_MICROVM_MACHINE)
+DECLARE_OBJ_CHECKERS(MicrovmMachineState, MicrovmMachineClass,
+ MICROVM_MACHINE, TYPE_MICROVM_MACHINE)
#endif
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 602b57dc5d..421a77acc2 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -123,12 +123,8 @@ struct PCMachineClass {
typedef struct PCMachineClass PCMachineClass;
#define TYPE_PC_MACHINE "generic-pc-machine"
-#define PC_MACHINE(obj) \
- OBJECT_CHECK(PCMachineState, (obj), TYPE_PC_MACHINE)
-#define PC_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PCMachineClass, (obj), TYPE_PC_MACHINE)
-#define PC_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
+DECLARE_OBJ_CHECKERS(PCMachineState, PCMachineClass,
+ PC_MACHINE, TYPE_PC_MACHINE)
/* ioapic.c */
diff --git a/include/hw/i386/x86-iommu.h b/include/hw/i386/x86-iommu.h
index dae2eab800..bbfaf44e79 100644
--- a/include/hw/i386/x86-iommu.h
+++ b/include/hw/i386/x86-iommu.h
@@ -28,12 +28,8 @@
#define TYPE_X86_IOMMU_DEVICE ("x86-iommu")
typedef struct X86IOMMUClass X86IOMMUClass;
typedef struct X86IOMMUState X86IOMMUState;
-#define X86_IOMMU_DEVICE(obj) \
- OBJECT_CHECK(X86IOMMUState, (obj), TYPE_X86_IOMMU_DEVICE)
-#define X86_IOMMU_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(X86IOMMUClass, (klass), TYPE_X86_IOMMU_DEVICE)
-#define X86_IOMMU_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(X86IOMMUClass, obj, TYPE_X86_IOMMU_DEVICE)
+DECLARE_OBJ_CHECKERS(X86IOMMUState, X86IOMMUClass,
+ X86_IOMMU_DEVICE, TYPE_X86_IOMMU_DEVICE)
#define X86_IOMMU_SID_INVALID (0xffff)
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index 42d46cc404..1a188a7dea 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -77,12 +77,8 @@ typedef struct X86MachineState X86MachineState;
#define X86_MACHINE_ACPI "acpi"
#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")
-#define X86_MACHINE(obj) \
- OBJECT_CHECK(X86MachineState, (obj), TYPE_X86_MACHINE)
-#define X86_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(X86MachineClass, obj, TYPE_X86_MACHINE)
-#define X86_MACHINE_CLASS(class) \
- OBJECT_CLASS_CHECK(X86MachineClass, class, TYPE_X86_MACHINE)
+DECLARE_OBJ_CHECKERS(X86MachineState, X86MachineClass,
+ X86_MACHINE, TYPE_X86_MACHINE)
void init_topo_info(X86CPUTopoInfo *topo_info, const X86MachineState *x86ms);
diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h
index 110269f152..4cf6813d80 100644
--- a/include/hw/ide/ahci.h
+++ b/include/hw/ide/ahci.h
@@ -54,15 +54,16 @@ typedef struct AHCIState {
typedef struct AHCIPCIState AHCIPCIState;
#define TYPE_ICH9_AHCI "ich9-ahci"
-#define ICH_AHCI(obj) \
- OBJECT_CHECK(AHCIPCIState, (obj), TYPE_ICH9_AHCI)
+DECLARE_INSTANCE_CHECKER(AHCIPCIState, ICH_AHCI,
+ TYPE_ICH9_AHCI)
int32_t ahci_get_num_ports(PCIDevice *dev);
void ahci_ide_create_devs(PCIDevice *dev, DriveInfo **hd);
#define TYPE_SYSBUS_AHCI "sysbus-ahci"
typedef struct SysbusAHCIState SysbusAHCIState;
-#define SYSBUS_AHCI(obj) OBJECT_CHECK(SysbusAHCIState, (obj), TYPE_SYSBUS_AHCI)
+DECLARE_INSTANCE_CHECKER(SysbusAHCIState, SYSBUS_AHCI,
+ TYPE_SYSBUS_AHCI)
struct SysbusAHCIState {
/*< private >*/
@@ -75,8 +76,8 @@ struct SysbusAHCIState {
#define TYPE_ALLWINNER_AHCI "allwinner-ahci"
typedef struct AllwinnerAHCIState AllwinnerAHCIState;
-#define ALLWINNER_AHCI(obj) \
- OBJECT_CHECK(AllwinnerAHCIState, (obj), TYPE_ALLWINNER_AHCI)
+DECLARE_INSTANCE_CHECKER(AllwinnerAHCIState, ALLWINNER_AHCI,
+ TYPE_ALLWINNER_AHCI)
#define ALLWINNER_AHCI_MMIO_OFF 0x80
#define ALLWINNER_AHCI_MMIO_SIZE 0x80
diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h
index 74ea1e324c..eb9eb4e0ae 100644
--- a/include/hw/ide/internal.h
+++ b/include/hw/ide/internal.h
@@ -26,7 +26,8 @@ typedef struct IDEDMA IDEDMA;
typedef struct IDEDMAOps IDEDMAOps;
#define TYPE_IDE_BUS "IDE"
-#define IDE_BUS(obj) OBJECT_CHECK(IDEBus, (obj), TYPE_IDE_BUS)
+DECLARE_INSTANCE_CHECKER(IDEBus, IDE_BUS,
+ TYPE_IDE_BUS)
#define MAX_IDE_DEVS 2
@@ -488,12 +489,8 @@ struct IDEBus {
#define TYPE_IDE_DEVICE "ide-device"
typedef struct IDEDeviceClass IDEDeviceClass;
-#define IDE_DEVICE(obj) \
- OBJECT_CHECK(IDEDevice, (obj), TYPE_IDE_DEVICE)
-#define IDE_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(IDEDeviceClass, (klass), TYPE_IDE_DEVICE)
-#define IDE_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IDEDeviceClass, (obj), TYPE_IDE_DEVICE)
+DECLARE_OBJ_CHECKERS(IDEDevice, IDEDeviceClass,
+ IDE_DEVICE, TYPE_IDE_DEVICE)
struct IDEDeviceClass {
DeviceClass parent_class;
diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h
index 7ed1fa101d..b8d7270ec8 100644
--- a/include/hw/ide/pci.h
+++ b/include/hw/ide/pci.h
@@ -41,7 +41,8 @@ typedef struct BMDMAState {
#define TYPE_PCI_IDE "pci-ide"
typedef struct PCIIDEState PCIIDEState;
-#define PCI_IDE(obj) OBJECT_CHECK(PCIIDEState, (obj), TYPE_PCI_IDE)
+DECLARE_INSTANCE_CHECKER(PCIIDEState, PCI_IDE,
+ TYPE_PCI_IDE)
struct PCIIDEState {
/*< private >*/
diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h
index ad89a21176..285f70db55 100644
--- a/include/hw/input/adb.h
+++ b/include/hw/input/adb.h
@@ -44,7 +44,8 @@ typedef bool ADBDeviceHasData(ADBDevice *d);
#define TYPE_ADB_DEVICE "adb-device"
typedef struct ADBDeviceClass ADBDeviceClass;
-#define ADB_DEVICE(obj) OBJECT_CHECK(ADBDevice, (obj), TYPE_ADB_DEVICE)
+DECLARE_OBJ_CHECKERS(ADBDevice, ADBDeviceClass,
+ ADB_DEVICE, TYPE_ADB_DEVICE)
struct ADBDevice {
/*< private >*/
@@ -55,10 +56,6 @@ struct ADBDevice {
int handler;
};
-#define ADB_DEVICE_CLASS(cls) \
- OBJECT_CLASS_CHECK(ADBDeviceClass, (cls), TYPE_ADB_DEVICE)
-#define ADB_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ADBDeviceClass, (obj), TYPE_ADB_DEVICE)
struct ADBDeviceClass {
/*< private >*/
@@ -70,7 +67,8 @@ struct ADBDeviceClass {
};
#define TYPE_ADB_BUS "apple-desktop-bus"
-#define ADB_BUS(obj) OBJECT_CHECK(ADBBusState, (obj), TYPE_ADB_BUS)
+DECLARE_INSTANCE_CHECKER(ADBBusState, ADB_BUS,
+ TYPE_ADB_BUS)
#define ADB_STATUS_BUSTIMEOUT 0x1
#define ADB_STATUS_POLLREPLY 0x2
diff --git a/include/hw/input/i8042.h b/include/hw/input/i8042.h
index d4bf584699..f8a3bf88ac 100644
--- a/include/hw/input/i8042.h
+++ b/include/hw/input/i8042.h
@@ -13,7 +13,8 @@
#define TYPE_I8042 "i8042"
typedef struct ISAKBDState ISAKBDState;
-#define I8042(obj) OBJECT_CHECK(ISAKBDState, (obj), TYPE_I8042)
+DECLARE_INSTANCE_CHECKER(ISAKBDState, I8042,
+ TYPE_I8042)
#define I8042_A20_LINE "a20"
diff --git a/include/hw/intc/allwinner-a10-pic.h b/include/hw/intc/allwinner-a10-pic.h
index 692d2a88d0..4d7199480a 100644
--- a/include/hw/intc/allwinner-a10-pic.h
+++ b/include/hw/intc/allwinner-a10-pic.h
@@ -6,7 +6,8 @@
#define TYPE_AW_A10_PIC "allwinner-a10-pic"
typedef struct AwA10PICState AwA10PICState;
-#define AW_A10_PIC(obj) OBJECT_CHECK(AwA10PICState, (obj), TYPE_AW_A10_PIC)
+DECLARE_INSTANCE_CHECKER(AwA10PICState, AW_A10_PIC,
+ TYPE_AW_A10_PIC)
#define AW_A10_PIC_VECTOR 0
#define AW_A10_PIC_BASE_ADDR 4
diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_common.h
index 2cbde9b7a9..7080375008 100644
--- a/include/hw/intc/arm_gic_common.h
+++ b/include/hw/intc/arm_gic_common.h
@@ -149,12 +149,8 @@ typedef struct GICState GICState;
#define TYPE_ARM_GIC_COMMON "arm_gic_common"
typedef struct ARMGICCommonClass ARMGICCommonClass;
-#define ARM_GIC_COMMON(obj) \
- OBJECT_CHECK(GICState, (obj), TYPE_ARM_GIC_COMMON)
-#define ARM_GIC_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(ARMGICCommonClass, (klass), TYPE_ARM_GIC_COMMON)
-#define ARM_GIC_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ARMGICCommonClass, (obj), TYPE_ARM_GIC_COMMON)
+DECLARE_OBJ_CHECKERS(GICState, ARMGICCommonClass,
+ ARM_GIC_COMMON, TYPE_ARM_GIC_COMMON)
struct ARMGICCommonClass {
/*< private >*/
diff --git a/include/hw/intc/arm_gicv3_common.h b/include/hw/intc/arm_gicv3_common.h
index 86fb060320..0331b0ffdb 100644
--- a/include/hw/intc/arm_gicv3_common.h
+++ b/include/hw/intc/arm_gicv3_common.h
@@ -281,12 +281,8 @@ GICV3_BITMAP_ACCESSORS(edge_trigger)
#define TYPE_ARM_GICV3_COMMON "arm-gicv3-common"
typedef struct ARMGICv3CommonClass ARMGICv3CommonClass;
-#define ARM_GICV3_COMMON(obj) \
- OBJECT_CHECK(GICv3State, (obj), TYPE_ARM_GICV3_COMMON)
-#define ARM_GICV3_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(ARMGICv3CommonClass, (klass), TYPE_ARM_GICV3_COMMON)
-#define ARM_GICV3_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ARMGICv3CommonClass, (obj), TYPE_ARM_GICV3_COMMON)
+DECLARE_OBJ_CHECKERS(GICv3State, ARMGICv3CommonClass,
+ ARM_GICV3_COMMON, TYPE_ARM_GICV3_COMMON)
struct ARMGICv3CommonClass {
/*< private >*/
diff --git a/include/hw/intc/arm_gicv3_its_common.h b/include/hw/intc/arm_gicv3_its_common.h
index 03a0fa335b..5a0952b404 100644
--- a/include/hw/intc/arm_gicv3_its_common.h
+++ b/include/hw/intc/arm_gicv3_its_common.h
@@ -66,12 +66,8 @@ void gicv3_its_init_mmio(GICv3ITSState *s, const MemoryRegionOps *ops);
#define TYPE_ARM_GICV3_ITS_COMMON "arm-gicv3-its-common"
typedef struct GICv3ITSCommonClass GICv3ITSCommonClass;
-#define ARM_GICV3_ITS_COMMON(obj) \
- OBJECT_CHECK(GICv3ITSState, (obj), TYPE_ARM_GICV3_ITS_COMMON)
-#define ARM_GICV3_ITS_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(GICv3ITSCommonClass, (klass), TYPE_ARM_GICV3_ITS_COMMON)
-#define ARM_GICV3_ITS_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(GICv3ITSCommonClass, (obj), TYPE_ARM_GICV3_ITS_COMMON)
+DECLARE_OBJ_CHECKERS(GICv3ITSState, GICv3ITSCommonClass,
+ ARM_GICV3_ITS_COMMON, TYPE_ARM_GICV3_ITS_COMMON)
struct GICv3ITSCommonClass {
/*< private >*/
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
index 63098822fa..bb087b23c3 100644
--- a/include/hw/intc/armv7m_nvic.h
+++ b/include/hw/intc/armv7m_nvic.h
@@ -18,8 +18,8 @@
#define TYPE_NVIC "armv7m_nvic"
typedef struct NVICState NVICState;
-#define NVIC(obj) \
- OBJECT_CHECK(NVICState, (obj), TYPE_NVIC)
+DECLARE_INSTANCE_CHECKER(NVICState, NVIC,
+ TYPE_NVIC)
/* Highest permitted number of exceptions (architectural limit) */
#define NVIC_MAX_VECTORS 512
diff --git a/include/hw/intc/aspeed_vic.h b/include/hw/intc/aspeed_vic.h
index f8844b3327..8f2e67db5a 100644
--- a/include/hw/intc/aspeed_vic.h
+++ b/include/hw/intc/aspeed_vic.h
@@ -18,7 +18,8 @@
#define TYPE_ASPEED_VIC "aspeed.vic"
typedef struct AspeedVICState AspeedVICState;
-#define ASPEED_VIC(obj) OBJECT_CHECK(AspeedVICState, (obj), TYPE_ASPEED_VIC)
+DECLARE_INSTANCE_CHECKER(AspeedVICState, ASPEED_VIC,
+ TYPE_ASPEED_VIC)
#define ASPEED_VIC_NR_IRQS 51
diff --git a/include/hw/intc/bcm2835_ic.h b/include/hw/intc/bcm2835_ic.h
index 4a9f093025..fd4a767845 100644
--- a/include/hw/intc/bcm2835_ic.h
+++ b/include/hw/intc/bcm2835_ic.h
@@ -13,7 +13,8 @@
#define TYPE_BCM2835_IC "bcm2835-ic"
typedef struct BCM2835ICState BCM2835ICState;
-#define BCM2835_IC(obj) OBJECT_CHECK(BCM2835ICState, (obj), TYPE_BCM2835_IC)
+DECLARE_INSTANCE_CHECKER(BCM2835ICState, BCM2835_IC,
+ TYPE_BCM2835_IC)
#define BCM2835_IC_GPU_IRQ "gpu-irq"
#define BCM2835_IC_ARM_IRQ "arm-irq"
diff --git a/include/hw/intc/bcm2836_control.h b/include/hw/intc/bcm2836_control.h
index 7d8a51fc72..f23292776e 100644
--- a/include/hw/intc/bcm2836_control.h
+++ b/include/hw/intc/bcm2836_control.h
@@ -25,8 +25,8 @@
#define TYPE_BCM2836_CONTROL "bcm2836-control"
typedef struct BCM2836ControlState BCM2836ControlState;
-#define BCM2836_CONTROL(obj) \
- OBJECT_CHECK(BCM2836ControlState, (obj), TYPE_BCM2836_CONTROL)
+DECLARE_INSTANCE_CHECKER(BCM2836ControlState, BCM2836_CONTROL,
+ TYPE_BCM2836_CONTROL)
struct BCM2836ControlState {
/*< private >*/
diff --git a/include/hw/intc/heathrow_pic.h b/include/hw/intc/heathrow_pic.h
index bd9fc115a8..f8c9bc20ab 100644
--- a/include/hw/intc/heathrow_pic.h
+++ b/include/hw/intc/heathrow_pic.h
@@ -31,7 +31,8 @@
#define TYPE_HEATHROW "heathrow"
typedef struct HeathrowState HeathrowState;
-#define HEATHROW(obj) OBJECT_CHECK(HeathrowState, (obj), TYPE_HEATHROW)
+DECLARE_INSTANCE_CHECKER(HeathrowState, HEATHROW,
+ TYPE_HEATHROW)
typedef struct HeathrowPICState {
uint32_t events;
diff --git a/include/hw/intc/ibex_plic.h b/include/hw/intc/ibex_plic.h
index 0125b36267..8da6b03805 100644
--- a/include/hw/intc/ibex_plic.h
+++ b/include/hw/intc/ibex_plic.h
@@ -24,8 +24,8 @@
#define TYPE_IBEX_PLIC "ibex-plic"
typedef struct IbexPlicState IbexPlicState;
-#define IBEX_PLIC(obj) \
- OBJECT_CHECK(IbexPlicState, (obj), TYPE_IBEX_PLIC)
+DECLARE_INSTANCE_CHECKER(IbexPlicState, IBEX_PLIC,
+ TYPE_IBEX_PLIC)
struct IbexPlicState {
/*< private >*/
diff --git a/include/hw/intc/imx_avic.h b/include/hw/intc/imx_avic.h
index 124f29f763..621742533c 100644
--- a/include/hw/intc/imx_avic.h
+++ b/include/hw/intc/imx_avic.h
@@ -22,7 +22,8 @@
#define TYPE_IMX_AVIC "imx.avic"
typedef struct IMXAVICState IMXAVICState;
-#define IMX_AVIC(obj) OBJECT_CHECK(IMXAVICState, (obj), TYPE_IMX_AVIC)
+DECLARE_INSTANCE_CHECKER(IMXAVICState, IMX_AVIC,
+ TYPE_IMX_AVIC)
#define IMX_AVIC_NUM_IRQS 64
diff --git a/include/hw/intc/imx_gpcv2.h b/include/hw/intc/imx_gpcv2.h
index 66befda3fd..2d8075e527 100644
--- a/include/hw/intc/imx_gpcv2.h
+++ b/include/hw/intc/imx_gpcv2.h
@@ -19,6 +19,7 @@ struct IMXGPCv2State {
typedef struct IMXGPCv2State IMXGPCv2State;
#define TYPE_IMX_GPCV2 "imx-gpcv2"
-#define IMX_GPCV2(obj) OBJECT_CHECK(IMXGPCv2State, (obj), TYPE_IMX_GPCV2)
+DECLARE_INSTANCE_CHECKER(IMXGPCv2State, IMX_GPCV2,
+ TYPE_IMX_GPCV2)
#endif /* IMX_GPCV2_H */
diff --git a/include/hw/intc/intc.h b/include/hw/intc/intc.h
index b51c0ac0f4..7018f608ca 100644
--- a/include/hw/intc/intc.h
+++ b/include/hw/intc/intc.h
@@ -6,12 +6,8 @@
#define TYPE_INTERRUPT_STATS_PROVIDER "intctrl"
typedef struct InterruptStatsProviderClass InterruptStatsProviderClass;
-#define INTERRUPT_STATS_PROVIDER_CLASS(klass) \
- OBJECT_CLASS_CHECK(InterruptStatsProviderClass, (klass), \
+DECLARE_CLASS_CHECKERS(InterruptStatsProviderClass, INTERRUPT_STATS_PROVIDER,
TYPE_INTERRUPT_STATS_PROVIDER)
-#define INTERRUPT_STATS_PROVIDER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(InterruptStatsProviderClass, (obj), \
- TYPE_INTERRUPT_STATS_PROVIDER)
#define INTERRUPT_STATS_PROVIDER(obj) \
INTERFACE_CHECK(InterruptStatsProvider, (obj), \
TYPE_INTERRUPT_STATS_PROVIDER)
diff --git a/include/hw/intc/mips_gic.h b/include/hw/intc/mips_gic.h
index 5670421e62..65aa3a9a5e 100644
--- a/include/hw/intc/mips_gic.h
+++ b/include/hw/intc/mips_gic.h
@@ -172,7 +172,8 @@
#define TYPE_MIPS_GIC "mips-gic"
typedef struct MIPSGICState MIPSGICState;
-#define MIPS_GIC(obj) OBJECT_CHECK(MIPSGICState, (obj), TYPE_MIPS_GIC)
+DECLARE_INSTANCE_CHECKER(MIPSGICState, MIPS_GIC,
+ TYPE_MIPS_GIC)
/* Support up to 32 VPs and 256 IRQs */
#define GIC_MAX_VPS 32
diff --git a/include/hw/intc/realview_gic.h b/include/hw/intc/realview_gic.h
index e633992b9c..a93ace87c8 100644
--- a/include/hw/intc/realview_gic.h
+++ b/include/hw/intc/realview_gic.h
@@ -16,8 +16,8 @@
#define TYPE_REALVIEW_GIC "realview_gic"
typedef struct RealViewGICState RealViewGICState;
-#define REALVIEW_GIC(obj) \
- OBJECT_CHECK(RealViewGICState, (obj), TYPE_REALVIEW_GIC)
+DECLARE_INSTANCE_CHECKER(RealViewGICState, REALVIEW_GIC,
+ TYPE_REALVIEW_GIC)
struct RealViewGICState {
SysBusDevice parent_obj;
diff --git a/include/hw/intc/rx_icu.h b/include/hw/intc/rx_icu.h
index 5660cb4e7f..ec02df35e3 100644
--- a/include/hw/intc/rx_icu.h
+++ b/include/hw/intc/rx_icu.h
@@ -72,6 +72,7 @@ struct RXICUState {
typedef struct RXICUState RXICUState;
#define TYPE_RX_ICU "rx-icu"
-#define RX_ICU(obj) OBJECT_CHECK(RXICUState, (obj), TYPE_RX_ICU)
+DECLARE_INSTANCE_CHECKER(RXICUState, RX_ICU,
+ TYPE_RX_ICU)
#endif /* RX_ICU_H */
diff --git a/include/hw/intc/xlnx-pmu-iomod-intc.h b/include/hw/intc/xlnx-pmu-iomod-intc.h
index fce35ac941..7a560e97af 100644
--- a/include/hw/intc/xlnx-pmu-iomod-intc.h
+++ b/include/hw/intc/xlnx-pmu-iomod-intc.h
@@ -32,8 +32,8 @@
#define TYPE_XLNX_PMU_IO_INTC "xlnx.pmu_io_intc"
typedef struct XlnxPMUIOIntc XlnxPMUIOIntc;
-#define XLNX_PMU_IO_INTC(obj) \
- OBJECT_CHECK(XlnxPMUIOIntc, (obj), TYPE_XLNX_PMU_IO_INTC)
+DECLARE_INSTANCE_CHECKER(XlnxPMUIOIntc, XLNX_PMU_IO_INTC,
+ TYPE_XLNX_PMU_IO_INTC)
/* This is R_PIT3_CONTROL + 1 */
#define XLNXPMUIOINTC_R_MAX (0x78 + 1)
diff --git a/include/hw/intc/xlnx-zynqmp-ipi.h b/include/hw/intc/xlnx-zynqmp-ipi.h
index 9044ca5afe..29c48db307 100644
--- a/include/hw/intc/xlnx-zynqmp-ipi.h
+++ b/include/hw/intc/xlnx-zynqmp-ipi.h
@@ -32,8 +32,8 @@
#define TYPE_XLNX_ZYNQMP_IPI "xlnx.zynqmp_ipi"
typedef struct XlnxZynqMPIPI XlnxZynqMPIPI;
-#define XLNX_ZYNQMP_IPI(obj) \
- OBJECT_CHECK(XlnxZynqMPIPI, (obj), TYPE_XLNX_ZYNQMP_IPI)
+DECLARE_INSTANCE_CHECKER(XlnxZynqMPIPI, XLNX_ZYNQMP_IPI,
+ TYPE_XLNX_ZYNQMP_IPI)
/* This is R_IPI_IDR + 1 */
#define R_XLNX_ZYNQMP_IPI_MAX ((0x1c / 4) + 1)
diff --git a/include/hw/ipack/ipack.h b/include/hw/ipack/ipack.h
index ac6105ff8b..a2304c1b3e 100644
--- a/include/hw/ipack/ipack.h
+++ b/include/hw/ipack/ipack.h
@@ -17,7 +17,8 @@
typedef struct IPackBus IPackBus;
#define TYPE_IPACK_BUS "IndustryPack"
-#define IPACK_BUS(obj) OBJECT_CHECK(IPackBus, (obj), TYPE_IPACK_BUS)
+DECLARE_INSTANCE_CHECKER(IPackBus, IPACK_BUS,
+ TYPE_IPACK_BUS)
struct IPackBus {
/*< private >*/
@@ -33,12 +34,8 @@ typedef struct IPackDevice IPackDevice;
typedef struct IPackDeviceClass IPackDeviceClass;
#define TYPE_IPACK_DEVICE "ipack-device"
-#define IPACK_DEVICE(obj) \
- OBJECT_CHECK(IPackDevice, (obj), TYPE_IPACK_DEVICE)
-#define IPACK_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(IPackDeviceClass, (klass), TYPE_IPACK_DEVICE)
-#define IPACK_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IPackDeviceClass, (obj), TYPE_IPACK_DEVICE)
+DECLARE_OBJ_CHECKERS(IPackDevice, IPackDeviceClass,
+ IPACK_DEVICE, TYPE_IPACK_DEVICE)
struct IPackDeviceClass {
/*< private >*/
diff --git a/include/hw/ipmi/ipmi.h b/include/hw/ipmi/ipmi.h
index 355a8714bb..01c9d497c4 100644
--- a/include/hw/ipmi/ipmi.h
+++ b/include/hw/ipmi/ipmi.h
@@ -112,10 +112,8 @@ uint32_t ipmi_next_uuid(void);
#define IPMI_INTERFACE(obj) \
INTERFACE_CHECK(IPMIInterface, (obj), TYPE_IPMI_INTERFACE)
typedef struct IPMIInterfaceClass IPMIInterfaceClass;
-#define IPMI_INTERFACE_CLASS(class) \
- OBJECT_CLASS_CHECK(IPMIInterfaceClass, (class), TYPE_IPMI_INTERFACE)
-#define IPMI_INTERFACE_GET_CLASS(class) \
- OBJECT_GET_CLASS(IPMIInterfaceClass, (class), TYPE_IPMI_INTERFACE)
+DECLARE_CLASS_CHECKERS(IPMIInterfaceClass, IPMI_INTERFACE,
+ TYPE_IPMI_INTERFACE)
typedef struct IPMIInterface IPMIInterface;
@@ -180,12 +178,8 @@ struct IPMIInterfaceClass {
#define TYPE_IPMI_BMC "ipmi-bmc"
typedef struct IPMIBmc IPMIBmc;
typedef struct IPMIBmcClass IPMIBmcClass;
-#define IPMI_BMC(obj) \
- OBJECT_CHECK(IPMIBmc, (obj), TYPE_IPMI_BMC)
-#define IPMI_BMC_CLASS(obj_class) \
- OBJECT_CLASS_CHECK(IPMIBmcClass, (obj_class), TYPE_IPMI_BMC)
-#define IPMI_BMC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IPMIBmcClass, (obj), TYPE_IPMI_BMC)
+DECLARE_OBJ_CHECKERS(IPMIBmc, IPMIBmcClass,
+ IPMI_BMC, TYPE_IPMI_BMC)
struct IPMIBmc {
DeviceState parent;
@@ -273,8 +267,8 @@ void ipmi_bmc_gen_event(IPMIBmc *b, uint8_t *evt, bool log);
#define TYPE_IPMI_BMC_SIMULATOR "ipmi-bmc-sim"
typedef struct IPMIBmcSim IPMIBmcSim;
-#define IPMI_BMC_SIMULATOR(obj) OBJECT_CHECK(IPMIBmcSim, (obj), \
- TYPE_IPMI_BMC_SIMULATOR)
+DECLARE_INSTANCE_CHECKER(IPMIBmcSim, IPMI_BMC_SIMULATOR,
+ TYPE_IPMI_BMC_SIMULATOR)
typedef struct RspBuffer {
diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h
index 69170df6f8..cd050bb9f2 100644
--- a/include/hw/isa/i8259_internal.h
+++ b/include/hw/isa/i8259_internal.h
@@ -34,12 +34,8 @@ typedef struct PICCommonState PICCommonState;
#define TYPE_PIC_COMMON "pic-common"
typedef struct PICCommonClass PICCommonClass;
-#define PIC_COMMON(obj) \
- OBJECT_CHECK(PICCommonState, (obj), TYPE_PIC_COMMON)
-#define PIC_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(PICCommonClass, (klass), TYPE_PIC_COMMON)
-#define PIC_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PICCommonClass, (obj), TYPE_PIC_COMMON)
+DECLARE_OBJ_CHECKERS(PICCommonState, PICCommonClass,
+ PIC_COMMON, TYPE_PIC_COMMON)
struct PICCommonClass {
ISADeviceClass parent_class;
diff --git a/include/hw/isa/isa.h b/include/hw/isa/isa.h
index c7f27d5aa9..ddb6a2d168 100644
--- a/include/hw/isa/isa.h
+++ b/include/hw/isa/isa.h
@@ -12,15 +12,12 @@
#define TYPE_ISA_DEVICE "isa-device"
typedef struct ISADeviceClass ISADeviceClass;
-#define ISA_DEVICE(obj) \
- OBJECT_CHECK(ISADevice, (obj), TYPE_ISA_DEVICE)
-#define ISA_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(ISADeviceClass, (klass), TYPE_ISA_DEVICE)
-#define ISA_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ISADeviceClass, (obj), TYPE_ISA_DEVICE)
+DECLARE_OBJ_CHECKERS(ISADevice, ISADeviceClass,
+ ISA_DEVICE, TYPE_ISA_DEVICE)
#define TYPE_ISA_BUS "ISA"
-#define ISA_BUS(obj) OBJECT_CHECK(ISABus, (obj), TYPE_ISA_BUS)
+DECLARE_INSTANCE_CHECKER(ISABus, ISA_BUS,
+ TYPE_ISA_BUS)
#define TYPE_APPLE_SMC "isa-applesmc"
#define APPLESMC_MAX_DATA_LENGTH 32
@@ -39,10 +36,8 @@ static inline uint16_t applesmc_port(void)
#define TYPE_ISADMA "isa-dma"
typedef struct IsaDmaClass IsaDmaClass;
-#define ISADMA_CLASS(klass) \
- OBJECT_CLASS_CHECK(IsaDmaClass, (klass), TYPE_ISADMA)
-#define ISADMA_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IsaDmaClass, (obj), TYPE_ISADMA)
+DECLARE_CLASS_CHECKERS(IsaDmaClass, ISADMA,
+ TYPE_ISADMA)
#define ISADMA(obj) \
INTERFACE_CHECK(IsaDma, (obj), TYPE_ISADMA)
diff --git a/include/hw/isa/pc87312.h b/include/hw/isa/pc87312.h
index c8e98ea029..a65168a157 100644
--- a/include/hw/isa/pc87312.h
+++ b/include/hw/isa/pc87312.h
@@ -31,7 +31,8 @@
#define TYPE_PC87312_SUPERIO "pc87312"
typedef struct PC87312State PC87312State;
-#define PC87312(obj) OBJECT_CHECK(PC87312State, (obj), TYPE_PC87312_SUPERIO)
+DECLARE_INSTANCE_CHECKER(PC87312State, PC87312,
+ TYPE_PC87312_SUPERIO)
struct PC87312State {
/*< private >*/
diff --git a/include/hw/isa/superio.h b/include/hw/isa/superio.h
index c782c8b64e..b9f5c19155 100644
--- a/include/hw/isa/superio.h
+++ b/include/hw/isa/superio.h
@@ -17,12 +17,8 @@
#define TYPE_ISA_SUPERIO "isa-superio"
typedef struct ISASuperIOClass ISASuperIOClass;
typedef struct ISASuperIODevice ISASuperIODevice;
-#define ISA_SUPERIO(obj) \
- OBJECT_CHECK(ISASuperIODevice, (obj), TYPE_ISA_SUPERIO)
-#define ISA_SUPERIO_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ISASuperIOClass, (obj), TYPE_ISA_SUPERIO)
-#define ISA_SUPERIO_CLASS(klass) \
- OBJECT_CLASS_CHECK(ISASuperIOClass, (klass), TYPE_ISA_SUPERIO)
+DECLARE_OBJ_CHECKERS(ISASuperIODevice, ISASuperIOClass,
+ ISA_SUPERIO, TYPE_ISA_SUPERIO)
#define SUPERIO_MAX_SERIAL_PORTS 4
diff --git a/include/hw/m68k/mcf_fec.h b/include/hw/m68k/mcf_fec.h
index c8ece3cb4b..840c5bbf53 100644
--- a/include/hw/m68k/mcf_fec.h
+++ b/include/hw/m68k/mcf_fec.h
@@ -13,7 +13,8 @@
#define TYPE_MCF_FEC_NET "mcf-fec"
typedef struct mcf_fec_state mcf_fec_state;
-#define MCF_FEC_NET(obj) OBJECT_CHECK(mcf_fec_state, (obj), TYPE_MCF_FEC_NET)
+DECLARE_INSTANCE_CHECKER(mcf_fec_state, MCF_FEC_NET,
+ TYPE_MCF_FEC_NET)
#define FEC_NUM_IRQ 13
diff --git a/include/hw/mem/memory-device.h b/include/hw/mem/memory-device.h
index d19bca5942..cde52e83c9 100644
--- a/include/hw/mem/memory-device.h
+++ b/include/hw/mem/memory-device.h
@@ -20,10 +20,8 @@
#define TYPE_MEMORY_DEVICE "memory-device"
typedef struct MemoryDeviceClass MemoryDeviceClass;
-#define MEMORY_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(MemoryDeviceClass, (klass), TYPE_MEMORY_DEVICE)
-#define MEMORY_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(MemoryDeviceClass, (obj), TYPE_MEMORY_DEVICE)
+DECLARE_CLASS_CHECKERS(MemoryDeviceClass, MEMORY_DEVICE,
+ TYPE_MEMORY_DEVICE)
#define MEMORY_DEVICE(obj) \
INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE)
diff --git a/include/hw/mem/nvdimm.h b/include/hw/mem/nvdimm.h
index 4b4a4b5b17..19e3d3092d 100644
--- a/include/hw/mem/nvdimm.h
+++ b/include/hw/mem/nvdimm.h
@@ -48,10 +48,8 @@
#define TYPE_NVDIMM "nvdimm"
typedef struct NVDIMMClass NVDIMMClass;
typedef struct NVDIMMDevice NVDIMMDevice;
-#define NVDIMM(obj) OBJECT_CHECK(NVDIMMDevice, (obj), TYPE_NVDIMM)
-#define NVDIMM_CLASS(oc) OBJECT_CLASS_CHECK(NVDIMMClass, (oc), TYPE_NVDIMM)
-#define NVDIMM_GET_CLASS(obj) OBJECT_GET_CLASS(NVDIMMClass, (obj), \
- TYPE_NVDIMM)
+DECLARE_OBJ_CHECKERS(NVDIMMDevice, NVDIMMClass,
+ NVDIMM, TYPE_NVDIMM)
#define NVDIMM_LABEL_SIZE_PROP "label-size"
#define NVDIMM_UUID_PROP "uuid"
diff --git a/include/hw/mem/pc-dimm.h b/include/hw/mem/pc-dimm.h
index 41d4ff39ba..86e3010243 100644
--- a/include/hw/mem/pc-dimm.h
+++ b/include/hw/mem/pc-dimm.h
@@ -23,12 +23,8 @@
#define TYPE_PC_DIMM "pc-dimm"
typedef struct PCDIMMDevice PCDIMMDevice;
typedef struct PCDIMMDeviceClass PCDIMMDeviceClass;
-#define PC_DIMM(obj) \
- OBJECT_CHECK(PCDIMMDevice, (obj), TYPE_PC_DIMM)
-#define PC_DIMM_CLASS(oc) \
- OBJECT_CLASS_CHECK(PCDIMMDeviceClass, (oc), TYPE_PC_DIMM)
-#define PC_DIMM_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PCDIMMDeviceClass, (obj), TYPE_PC_DIMM)
+DECLARE_OBJ_CHECKERS(PCDIMMDevice, PCDIMMDeviceClass,
+ PC_DIMM, TYPE_PC_DIMM)
#define PC_DIMM_ADDR_PROP "addr"
#define PC_DIMM_SLOT_PROP "slot"
diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.h
index ab79a66b1d..849e640570 100644
--- a/include/hw/mips/cps.h
+++ b/include/hw/mips/cps.h
@@ -30,7 +30,8 @@
#define TYPE_MIPS_CPS "mips-cps"
typedef struct MIPSCPSState MIPSCPSState;
-#define MIPS_CPS(obj) OBJECT_CHECK(MIPSCPSState, (obj), TYPE_MIPS_CPS)
+DECLARE_INSTANCE_CHECKER(MIPSCPSState, MIPS_CPS,
+ TYPE_MIPS_CPS)
struct MIPSCPSState {
SysBusDevice parent_obj;
diff --git a/include/hw/misc/a9scu.h b/include/hw/misc/a9scu.h
index c5481f4dbb..fd1b92e923 100644
--- a/include/hw/misc/a9scu.h
+++ b/include/hw/misc/a9scu.h
@@ -28,6 +28,7 @@ struct A9SCUState {
typedef struct A9SCUState A9SCUState;
#define TYPE_A9_SCU "a9-scu"
-#define A9_SCU(obj) OBJECT_CHECK(A9SCUState, (obj), TYPE_A9_SCU)
+DECLARE_INSTANCE_CHECKER(A9SCUState, A9_SCU,
+ TYPE_A9_SCU)
#endif
diff --git a/include/hw/misc/allwinner-cpucfg.h b/include/hw/misc/allwinner-cpucfg.h
index f5420b11d5..058514de15 100644
--- a/include/hw/misc/allwinner-cpucfg.h
+++ b/include/hw/misc/allwinner-cpucfg.h
@@ -30,8 +30,8 @@
#define TYPE_AW_CPUCFG "allwinner-cpucfg"
typedef struct AwCpuCfgState AwCpuCfgState;
-#define AW_CPUCFG(obj) \
- OBJECT_CHECK(AwCpuCfgState, (obj), TYPE_AW_CPUCFG)
+DECLARE_INSTANCE_CHECKER(AwCpuCfgState, AW_CPUCFG,
+ TYPE_AW_CPUCFG)
/** @} */
diff --git a/include/hw/misc/allwinner-h3-ccu.h b/include/hw/misc/allwinner-h3-ccu.h
index 60f0c56cd9..05f5c7bd8e 100644
--- a/include/hw/misc/allwinner-h3-ccu.h
+++ b/include/hw/misc/allwinner-h3-ccu.h
@@ -43,8 +43,8 @@
#define TYPE_AW_H3_CCU "allwinner-h3-ccu"
typedef struct AwH3ClockCtlState AwH3ClockCtlState;
-#define AW_H3_CCU(obj) \
- OBJECT_CHECK(AwH3ClockCtlState, (obj), TYPE_AW_H3_CCU)
+DECLARE_INSTANCE_CHECKER(AwH3ClockCtlState, AW_H3_CCU,
+ TYPE_AW_H3_CCU)
/** @} */
diff --git a/include/hw/misc/allwinner-h3-dramc.h b/include/hw/misc/allwinner-h3-dramc.h
index 0538e598b0..60a13a6958 100644
--- a/include/hw/misc/allwinner-h3-dramc.h
+++ b/include/hw/misc/allwinner-h3-dramc.h
@@ -59,8 +59,8 @@
#define TYPE_AW_H3_DRAMC "allwinner-h3-dramc"
typedef struct AwH3DramCtlState AwH3DramCtlState;
-#define AW_H3_DRAMC(obj) \
- OBJECT_CHECK(AwH3DramCtlState, (obj), TYPE_AW_H3_DRAMC)
+DECLARE_INSTANCE_CHECKER(AwH3DramCtlState, AW_H3_DRAMC,
+ TYPE_AW_H3_DRAMC)
/** @} */
diff --git a/include/hw/misc/allwinner-h3-sysctrl.h b/include/hw/misc/allwinner-h3-sysctrl.h
index 7360698f8f..50baa8eb07 100644
--- a/include/hw/misc/allwinner-h3-sysctrl.h
+++ b/include/hw/misc/allwinner-h3-sysctrl.h
@@ -44,8 +44,8 @@
#define TYPE_AW_H3_SYSCTRL "allwinner-h3-sysctrl"
typedef struct AwH3SysCtrlState AwH3SysCtrlState;
-#define AW_H3_SYSCTRL(obj) \
- OBJECT_CHECK(AwH3SysCtrlState, (obj), TYPE_AW_H3_SYSCTRL)
+DECLARE_INSTANCE_CHECKER(AwH3SysCtrlState, AW_H3_SYSCTRL,
+ TYPE_AW_H3_SYSCTRL)
/** @} */
diff --git a/include/hw/misc/allwinner-sid.h b/include/hw/misc/allwinner-sid.h
index 70cd7cc7c0..b8e83bb7ce 100644
--- a/include/hw/misc/allwinner-sid.h
+++ b/include/hw/misc/allwinner-sid.h
@@ -31,8 +31,8 @@
#define TYPE_AW_SID "allwinner-sid"
typedef struct AwSidState AwSidState;
-#define AW_SID(obj) \
- OBJECT_CHECK(AwSidState, (obj), TYPE_AW_SID)
+DECLARE_INSTANCE_CHECKER(AwSidState, AW_SID,
+ TYPE_AW_SID)
/** @} */
diff --git a/include/hw/misc/arm11scu.h b/include/hw/misc/arm11scu.h
index 7e2e6d2b44..71b4bc9a22 100644
--- a/include/hw/misc/arm11scu.h
+++ b/include/hw/misc/arm11scu.h
@@ -16,7 +16,8 @@
#define TYPE_ARM11_SCU "arm11-scu"
typedef struct ARM11SCUState ARM11SCUState;
-#define ARM11_SCU(obj) OBJECT_CHECK(ARM11SCUState, (obj), TYPE_ARM11_SCU)
+DECLARE_INSTANCE_CHECKER(ARM11SCUState, ARM11_SCU,
+ TYPE_ARM11_SCU)
struct ARM11SCUState {
/*< private >*/
diff --git a/include/hw/misc/armsse-cpuid.h b/include/hw/misc/armsse-cpuid.h
index 290a52cf10..80691c7180 100644
--- a/include/hw/misc/armsse-cpuid.h
+++ b/include/hw/misc/armsse-cpuid.h
@@ -27,7 +27,8 @@
#define TYPE_ARMSSE_CPUID "armsse-cpuid"
typedef struct ARMSSECPUID ARMSSECPUID;
-#define ARMSSE_CPUID(obj) OBJECT_CHECK(ARMSSECPUID, (obj), TYPE_ARMSSE_CPUID)
+DECLARE_INSTANCE_CHECKER(ARMSSECPUID, ARMSSE_CPUID,
+ TYPE_ARMSSE_CPUID)
struct ARMSSECPUID {
/*< private >*/
diff --git a/include/hw/misc/armsse-mhu.h b/include/hw/misc/armsse-mhu.h
index d1ae4a463a..310643a022 100644
--- a/include/hw/misc/armsse-mhu.h
+++ b/include/hw/misc/armsse-mhu.h
@@ -28,7 +28,8 @@
#define TYPE_ARMSSE_MHU "armsse-mhu"
typedef struct ARMSSEMHU ARMSSEMHU;
-#define ARMSSE_MHU(obj) OBJECT_CHECK(ARMSSEMHU, (obj), TYPE_ARMSSE_MHU)
+DECLARE_INSTANCE_CHECKER(ARMSSEMHU, ARMSSE_MHU,
+ TYPE_ARMSSE_MHU)
struct ARMSSEMHU {
/*< private >*/
diff --git a/include/hw/misc/aspeed_scu.h b/include/hw/misc/aspeed_scu.h
index feebb1baf6..8d3b14acd4 100644
--- a/include/hw/misc/aspeed_scu.h
+++ b/include/hw/misc/aspeed_scu.h
@@ -17,7 +17,8 @@
#define TYPE_ASPEED_SCU "aspeed.scu"
typedef struct AspeedSCUClass AspeedSCUClass;
typedef struct AspeedSCUState AspeedSCUState;
-#define ASPEED_SCU(obj) OBJECT_CHECK(AspeedSCUState, (obj), TYPE_ASPEED_SCU)
+DECLARE_OBJ_CHECKERS(AspeedSCUState, AspeedSCUClass,
+ ASPEED_SCU, TYPE_ASPEED_SCU)
#define TYPE_ASPEED_2400_SCU TYPE_ASPEED_SCU "-ast2400"
#define TYPE_ASPEED_2500_SCU TYPE_ASPEED_SCU "-ast2500"
#define TYPE_ASPEED_2600_SCU TYPE_ASPEED_SCU "-ast2600"
@@ -50,10 +51,6 @@ struct AspeedSCUState {
extern bool is_supported_silicon_rev(uint32_t silicon_rev);
-#define ASPEED_SCU_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedSCUClass, (klass), TYPE_ASPEED_SCU)
-#define ASPEED_SCU_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedSCUClass, (obj), TYPE_ASPEED_SCU)
struct AspeedSCUClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/misc/aspeed_sdmc.h b/include/hw/misc/aspeed_sdmc.h
index 3d98817715..3375afc89b 100644
--- a/include/hw/misc/aspeed_sdmc.h
+++ b/include/hw/misc/aspeed_sdmc.h
@@ -15,7 +15,8 @@
#define TYPE_ASPEED_SDMC "aspeed.sdmc"
typedef struct AspeedSDMCClass AspeedSDMCClass;
typedef struct AspeedSDMCState AspeedSDMCState;
-#define ASPEED_SDMC(obj) OBJECT_CHECK(AspeedSDMCState, (obj), TYPE_ASPEED_SDMC)
+DECLARE_OBJ_CHECKERS(AspeedSDMCState, AspeedSDMCClass,
+ ASPEED_SDMC, TYPE_ASPEED_SDMC)
#define TYPE_ASPEED_2400_SDMC TYPE_ASPEED_SDMC "-ast2400"
#define TYPE_ASPEED_2500_SDMC TYPE_ASPEED_SDMC "-ast2500"
#define TYPE_ASPEED_2600_SDMC TYPE_ASPEED_SDMC "-ast2600"
@@ -45,10 +46,6 @@ struct AspeedSDMCState {
uint64_t max_ram_size;
};
-#define ASPEED_SDMC_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedSDMCClass, (klass), TYPE_ASPEED_SDMC)
-#define ASPEED_SDMC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedSDMCClass, (obj), TYPE_ASPEED_SDMC)
struct AspeedSDMCClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/misc/aspeed_xdma.h b/include/hw/misc/aspeed_xdma.h
index e5177e2c02..0e62c04520 100644
--- a/include/hw/misc/aspeed_xdma.h
+++ b/include/hw/misc/aspeed_xdma.h
@@ -14,7 +14,8 @@
#define TYPE_ASPEED_XDMA "aspeed.xdma"
typedef struct AspeedXDMAState AspeedXDMAState;
-#define ASPEED_XDMA(obj) OBJECT_CHECK(AspeedXDMAState, (obj), TYPE_ASPEED_XDMA)
+DECLARE_INSTANCE_CHECKER(AspeedXDMAState, ASPEED_XDMA,
+ TYPE_ASPEED_XDMA)
#define ASPEED_XDMA_NUM_REGS (ASPEED_XDMA_REG_SIZE / sizeof(uint32_t))
#define ASPEED_XDMA_REG_SIZE 0x7C
diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h
index f24f2fd789..f910d94118 100644
--- a/include/hw/misc/auxbus.h
+++ b/include/hw/misc/auxbus.h
@@ -36,7 +36,8 @@ typedef enum AUXReply AUXReply;
#define TYPE_AUXTOI2C "aux-to-i2c-bridge"
typedef struct AUXTOI2CState AUXTOI2CState;
-#define AUXTOI2C(obj) OBJECT_CHECK(AUXTOI2CState, (obj), TYPE_AUXTOI2C)
+DECLARE_INSTANCE_CHECKER(AUXTOI2CState, AUXTOI2C,
+ TYPE_AUXTOI2C)
enum AUXCommand {
WRITE_I2C = 0,
@@ -57,7 +58,8 @@ enum AUXReply {
};
#define TYPE_AUX_BUS "aux-bus"
-#define AUX_BUS(obj) OBJECT_CHECK(AUXBus, (obj), TYPE_AUX_BUS)
+DECLARE_INSTANCE_CHECKER(AUXBus, AUX_BUS,
+ TYPE_AUX_BUS)
struct AUXBus {
/* < private > */
@@ -76,8 +78,8 @@ struct AUXBus {
};
#define TYPE_AUX_SLAVE "aux-slave"
-#define AUX_SLAVE(obj) \
- OBJECT_CHECK(AUXSlave, (obj), TYPE_AUX_SLAVE)
+DECLARE_INSTANCE_CHECKER(AUXSlave, AUX_SLAVE,
+ TYPE_AUX_SLAVE)
struct AUXSlave {
/* < private > */
diff --git a/include/hw/misc/avr_power.h b/include/hw/misc/avr_power.h
index c230a2655c..938ab3e21b 100644
--- a/include/hw/misc/avr_power.h
+++ b/include/hw/misc/avr_power.h
@@ -32,7 +32,8 @@
#define TYPE_AVR_MASK "avr-power"
typedef struct AVRMaskState AVRMaskState;
-#define AVR_MASK(obj) OBJECT_CHECK(AVRMaskState, (obj), TYPE_AVR_MASK)
+DECLARE_INSTANCE_CHECKER(AVRMaskState, AVR_MASK,
+ TYPE_AVR_MASK)
struct AVRMaskState {
/* <private> */
diff --git a/include/hw/misc/bcm2835_mbox.h b/include/hw/misc/bcm2835_mbox.h
index 3ec6a2f0e8..d8c8017f4e 100644
--- a/include/hw/misc/bcm2835_mbox.h
+++ b/include/hw/misc/bcm2835_mbox.h
@@ -14,8 +14,8 @@
#define TYPE_BCM2835_MBOX "bcm2835-mbox"
typedef struct BCM2835MboxState BCM2835MboxState;
-#define BCM2835_MBOX(obj) \
- OBJECT_CHECK(BCM2835MboxState, (obj), TYPE_BCM2835_MBOX)
+DECLARE_INSTANCE_CHECKER(BCM2835MboxState, BCM2835_MBOX,
+ TYPE_BCM2835_MBOX)
typedef struct {
uint32_t reg[MBOX_SIZE];
diff --git a/include/hw/misc/bcm2835_mphi.h b/include/hw/misc/bcm2835_mphi.h
index ce1c273cfb..249511182e 100644
--- a/include/hw/misc/bcm2835_mphi.h
+++ b/include/hw/misc/bcm2835_mphi.h
@@ -39,7 +39,7 @@ struct BCM2835MphiState {
#define TYPE_BCM2835_MPHI "bcm2835-mphi"
-#define BCM2835_MPHI(obj) \
- OBJECT_CHECK(BCM2835MphiState, (obj), TYPE_BCM2835_MPHI)
+DECLARE_INSTANCE_CHECKER(BCM2835MphiState, BCM2835_MPHI,
+ TYPE_BCM2835_MPHI)
#endif
diff --git a/include/hw/misc/bcm2835_property.h b/include/hw/misc/bcm2835_property.h
index 28bf2b49b6..5c827a1900 100644
--- a/include/hw/misc/bcm2835_property.h
+++ b/include/hw/misc/bcm2835_property.h
@@ -15,8 +15,8 @@
#define TYPE_BCM2835_PROPERTY "bcm2835-property"
typedef struct BCM2835PropertyState BCM2835PropertyState;
-#define BCM2835_PROPERTY(obj) \
- OBJECT_CHECK(BCM2835PropertyState, (obj), TYPE_BCM2835_PROPERTY)
+DECLARE_INSTANCE_CHECKER(BCM2835PropertyState, BCM2835_PROPERTY,
+ TYPE_BCM2835_PROPERTY)
struct BCM2835PropertyState {
/*< private >*/
diff --git a/include/hw/misc/bcm2835_rng.h b/include/hw/misc/bcm2835_rng.h
index 0921d9b3f1..fec76eef8e 100644
--- a/include/hw/misc/bcm2835_rng.h
+++ b/include/hw/misc/bcm2835_rng.h
@@ -15,8 +15,8 @@
#define TYPE_BCM2835_RNG "bcm2835-rng"
typedef struct BCM2835RngState BCM2835RngState;
-#define BCM2835_RNG(obj) \
- OBJECT_CHECK(BCM2835RngState, (obj), TYPE_BCM2835_RNG)
+DECLARE_INSTANCE_CHECKER(BCM2835RngState, BCM2835_RNG,
+ TYPE_BCM2835_RNG)
struct BCM2835RngState {
SysBusDevice busdev;
diff --git a/include/hw/misc/bcm2835_thermal.h b/include/hw/misc/bcm2835_thermal.h
index 2b937527eb..5b827c970e 100644
--- a/include/hw/misc/bcm2835_thermal.h
+++ b/include/hw/misc/bcm2835_thermal.h
@@ -15,8 +15,8 @@
#define TYPE_BCM2835_THERMAL "bcm2835-thermal"
typedef struct Bcm2835ThermalState Bcm2835ThermalState;
-#define BCM2835_THERMAL(obj) \
- OBJECT_CHECK(Bcm2835ThermalState, (obj), TYPE_BCM2835_THERMAL)
+DECLARE_INSTANCE_CHECKER(Bcm2835ThermalState, BCM2835_THERMAL,
+ TYPE_BCM2835_THERMAL)
struct Bcm2835ThermalState {
/*< private >*/
diff --git a/include/hw/misc/grlib_ahb_apb_pnp.h b/include/hw/misc/grlib_ahb_apb_pnp.h
index 427606fd6b..34b18e3193 100644
--- a/include/hw/misc/grlib_ahb_apb_pnp.h
+++ b/include/hw/misc/grlib_ahb_apb_pnp.h
@@ -27,13 +27,13 @@
#define TYPE_GRLIB_AHB_PNP "grlib,ahbpnp"
typedef struct AHBPnp AHBPnp;
-#define GRLIB_AHB_PNP(obj) \
- OBJECT_CHECK(AHBPnp, (obj), TYPE_GRLIB_AHB_PNP)
+DECLARE_INSTANCE_CHECKER(AHBPnp, GRLIB_AHB_PNP,
+ TYPE_GRLIB_AHB_PNP)
#define TYPE_GRLIB_APB_PNP "grlib,apbpnp"
typedef struct APBPnp APBPnp;
-#define GRLIB_APB_PNP(obj) \
- OBJECT_CHECK(APBPnp, (obj), TYPE_GRLIB_APB_PNP)
+DECLARE_INSTANCE_CHECKER(APBPnp, GRLIB_APB_PNP,
+ TYPE_GRLIB_APB_PNP)
void grlib_ahb_pnp_add_entry(AHBPnp *dev, uint32_t address, uint32_t mask,
uint8_t vendor, uint16_t device, int slave,
diff --git a/include/hw/misc/imx25_ccm.h b/include/hw/misc/imx25_ccm.h
index 8a7a9b675f..55c5db8815 100644
--- a/include/hw/misc/imx25_ccm.h
+++ b/include/hw/misc/imx25_ccm.h
@@ -65,7 +65,8 @@
#define TYPE_IMX25_CCM "imx25.ccm"
typedef struct IMX25CCMState IMX25CCMState;
-#define IMX25_CCM(obj) OBJECT_CHECK(IMX25CCMState, (obj), TYPE_IMX25_CCM)
+DECLARE_INSTANCE_CHECKER(IMX25CCMState, IMX25_CCM,
+ TYPE_IMX25_CCM)
struct IMX25CCMState {
/* <private> */
diff --git a/include/hw/misc/imx31_ccm.h b/include/hw/misc/imx31_ccm.h
index a56ee992af..25e280e976 100644
--- a/include/hw/misc/imx31_ccm.h
+++ b/include/hw/misc/imx31_ccm.h
@@ -74,7 +74,8 @@
#define TYPE_IMX31_CCM "imx31.ccm"
typedef struct IMX31CCMState IMX31CCMState;
-#define IMX31_CCM(obj) OBJECT_CHECK(IMX31CCMState, (obj), TYPE_IMX31_CCM)
+DECLARE_INSTANCE_CHECKER(IMX31CCMState, IMX31_CCM,
+ TYPE_IMX31_CCM)
struct IMX31CCMState {
/* <private> */
diff --git a/include/hw/misc/imx6_ccm.h b/include/hw/misc/imx6_ccm.h
index affa13087e..85f32417d6 100644
--- a/include/hw/misc/imx6_ccm.h
+++ b/include/hw/misc/imx6_ccm.h
@@ -180,7 +180,8 @@
#define TYPE_IMX6_CCM "imx6.ccm"
typedef struct IMX6CCMState IMX6CCMState;
-#define IMX6_CCM(obj) OBJECT_CHECK(IMX6CCMState, (obj), TYPE_IMX6_CCM)
+DECLARE_INSTANCE_CHECKER(IMX6CCMState, IMX6_CCM,
+ TYPE_IMX6_CCM)
struct IMX6CCMState {
/* <private> */
diff --git a/include/hw/misc/imx6_src.h b/include/hw/misc/imx6_src.h
index f1d70ec177..15b51757ba 100644
--- a/include/hw/misc/imx6_src.h
+++ b/include/hw/misc/imx6_src.h
@@ -59,7 +59,8 @@
#define TYPE_IMX6_SRC "imx6.src"
typedef struct IMX6SRCState IMX6SRCState;
-#define IMX6_SRC(obj) OBJECT_CHECK(IMX6SRCState, (obj), TYPE_IMX6_SRC)
+DECLARE_INSTANCE_CHECKER(IMX6SRCState, IMX6_SRC,
+ TYPE_IMX6_SRC)
struct IMX6SRCState {
/* <private> */
diff --git a/include/hw/misc/imx6ul_ccm.h b/include/hw/misc/imx6ul_ccm.h
index 2304c6e738..d614de0edd 100644
--- a/include/hw/misc/imx6ul_ccm.h
+++ b/include/hw/misc/imx6ul_ccm.h
@@ -209,7 +209,8 @@
#define TYPE_IMX6UL_CCM "imx6ul.ccm"
typedef struct IMX6ULCCMState IMX6ULCCMState;
-#define IMX6UL_CCM(obj) OBJECT_CHECK(IMX6ULCCMState, (obj), TYPE_IMX6UL_CCM)
+DECLARE_INSTANCE_CHECKER(IMX6ULCCMState, IMX6UL_CCM,
+ TYPE_IMX6UL_CCM)
struct IMX6ULCCMState {
/* <private> */
diff --git a/include/hw/misc/imx7_ccm.h b/include/hw/misc/imx7_ccm.h
index 9e9e58a5c2..e2757622d0 100644
--- a/include/hw/misc/imx7_ccm.h
+++ b/include/hw/misc/imx7_ccm.h
@@ -106,7 +106,8 @@ enum IMX7PMURegisters {
#define TYPE_IMX7_CCM "imx7.ccm"
typedef struct IMX7CCMState IMX7CCMState;
-#define IMX7_CCM(obj) OBJECT_CHECK(IMX7CCMState, (obj), TYPE_IMX7_CCM)
+DECLARE_INSTANCE_CHECKER(IMX7CCMState, IMX7_CCM,
+ TYPE_IMX7_CCM)
struct IMX7CCMState {
/* <private> */
@@ -121,7 +122,8 @@ struct IMX7CCMState {
#define TYPE_IMX7_ANALOG "imx7.analog"
typedef struct IMX7AnalogState IMX7AnalogState;
-#define IMX7_ANALOG(obj) OBJECT_CHECK(IMX7AnalogState, (obj), TYPE_IMX7_ANALOG)
+DECLARE_INSTANCE_CHECKER(IMX7AnalogState, IMX7_ANALOG,
+ TYPE_IMX7_ANALOG)
struct IMX7AnalogState {
/* <private> */
diff --git a/include/hw/misc/imx7_gpr.h b/include/hw/misc/imx7_gpr.h
index 83384ec0cc..f80b3ed28c 100644
--- a/include/hw/misc/imx7_gpr.h
+++ b/include/hw/misc/imx7_gpr.h
@@ -18,7 +18,8 @@
#define TYPE_IMX7_GPR "imx7.gpr"
typedef struct IMX7GPRState IMX7GPRState;
-#define IMX7_GPR(obj) OBJECT_CHECK(IMX7GPRState, (obj), TYPE_IMX7_GPR)
+DECLARE_INSTANCE_CHECKER(IMX7GPRState, IMX7_GPR,
+ TYPE_IMX7_GPR)
struct IMX7GPRState {
/* <private> */
diff --git a/include/hw/misc/imx7_snvs.h b/include/hw/misc/imx7_snvs.h
index f8659acb7d..ea5395c107 100644
--- a/include/hw/misc/imx7_snvs.h
+++ b/include/hw/misc/imx7_snvs.h
@@ -25,7 +25,8 @@ enum IMX7SNVSRegisters {
#define TYPE_IMX7_SNVS "imx7.snvs"
typedef struct IMX7SNVSState IMX7SNVSState;
-#define IMX7_SNVS(obj) OBJECT_CHECK(IMX7SNVSState, (obj), TYPE_IMX7_SNVS)
+DECLARE_INSTANCE_CHECKER(IMX7SNVSState, IMX7_SNVS,
+ TYPE_IMX7_SNVS)
struct IMX7SNVSState {
/* <private> */
diff --git a/include/hw/misc/imx_ccm.h b/include/hw/misc/imx_ccm.h
index 174248e5df..e9d82a2a50 100644
--- a/include/hw/misc/imx_ccm.h
+++ b/include/hw/misc/imx_ccm.h
@@ -30,12 +30,8 @@
#define TYPE_IMX_CCM "imx.ccm"
typedef struct IMXCCMClass IMXCCMClass;
typedef struct IMXCCMState IMXCCMState;
-#define IMX_CCM(obj) \
- OBJECT_CHECK(IMXCCMState, (obj), TYPE_IMX_CCM)
-#define IMX_CCM_CLASS(klass) \
- OBJECT_CLASS_CHECK(IMXCCMClass, (klass), TYPE_IMX_CCM)
-#define IMX_CCM_GET_CLASS(obj) \
- OBJECT_GET_CLASS(IMXCCMClass, (obj), TYPE_IMX_CCM)
+DECLARE_OBJ_CHECKERS(IMXCCMState, IMXCCMClass,
+ IMX_CCM, TYPE_IMX_CCM)
struct IMXCCMState {
/* <private> */
diff --git a/include/hw/misc/imx_rngc.h b/include/hw/misc/imx_rngc.h
index cd7ba8f91e..f7b569cac5 100644
--- a/include/hw/misc/imx_rngc.h
+++ b/include/hw/misc/imx_rngc.h
@@ -15,7 +15,8 @@
#define TYPE_IMX_RNGC "imx.rngc"
typedef struct IMXRNGCState IMXRNGCState;
-#define IMX_RNGC(obj) OBJECT_CHECK(IMXRNGCState, (obj), TYPE_IMX_RNGC)
+DECLARE_INSTANCE_CHECKER(IMXRNGCState, IMX_RNGC,
+ TYPE_IMX_RNGC)
struct IMXRNGCState {
/*< private >*/
diff --git a/include/hw/misc/iotkit-secctl.h b/include/hw/misc/iotkit-secctl.h
index 3d54d8f3de..d062ed43e7 100644
--- a/include/hw/misc/iotkit-secctl.h
+++ b/include/hw/misc/iotkit-secctl.h
@@ -60,7 +60,8 @@
#define TYPE_IOTKIT_SECCTL "iotkit-secctl"
typedef struct IoTKitSecCtl IoTKitSecCtl;
-#define IOTKIT_SECCTL(obj) OBJECT_CHECK(IoTKitSecCtl, (obj), TYPE_IOTKIT_SECCTL)
+DECLARE_INSTANCE_CHECKER(IoTKitSecCtl, IOTKIT_SECCTL,
+ TYPE_IOTKIT_SECCTL)
#define IOTS_APB_PPC0_NUM_PORTS 3
#define IOTS_APB_PPC1_NUM_PORTS 1
diff --git a/include/hw/misc/iotkit-sysctl.h b/include/hw/misc/iotkit-sysctl.h
index 27fe6346e6..22ceb5d76d 100644
--- a/include/hw/misc/iotkit-sysctl.h
+++ b/include/hw/misc/iotkit-sysctl.h
@@ -32,8 +32,8 @@
#define TYPE_IOTKIT_SYSCTL "iotkit-sysctl"
typedef struct IoTKitSysCtl IoTKitSysCtl;
-#define IOTKIT_SYSCTL(obj) OBJECT_CHECK(IoTKitSysCtl, (obj), \
- TYPE_IOTKIT_SYSCTL)
+DECLARE_INSTANCE_CHECKER(IoTKitSysCtl, IOTKIT_SYSCTL,
+ TYPE_IOTKIT_SYSCTL)
struct IoTKitSysCtl {
/*< private >*/
diff --git a/include/hw/misc/iotkit-sysinfo.h b/include/hw/misc/iotkit-sysinfo.h
index e0e610c75c..23ae43e549 100644
--- a/include/hw/misc/iotkit-sysinfo.h
+++ b/include/hw/misc/iotkit-sysinfo.h
@@ -27,8 +27,8 @@
#define TYPE_IOTKIT_SYSINFO "iotkit-sysinfo"
typedef struct IoTKitSysInfo IoTKitSysInfo;
-#define IOTKIT_SYSINFO(obj) OBJECT_CHECK(IoTKitSysInfo, (obj), \
- TYPE_IOTKIT_SYSINFO)
+DECLARE_INSTANCE_CHECKER(IoTKitSysInfo, IOTKIT_SYSINFO,
+ TYPE_IOTKIT_SYSINFO)
struct IoTKitSysInfo {
/*< private >*/
diff --git a/include/hw/misc/mac_via.h b/include/hw/misc/mac_via.h
index a59750634f..862cbba3ab 100644
--- a/include/hw/misc/mac_via.h
+++ b/include/hw/misc/mac_via.h
@@ -33,8 +33,8 @@
#define TYPE_MOS6522_Q800_VIA1 "mos6522-q800-via1"
typedef struct MOS6522Q800VIA1State MOS6522Q800VIA1State;
-#define MOS6522_Q800_VIA1(obj) OBJECT_CHECK(MOS6522Q800VIA1State, (obj), \
- TYPE_MOS6522_Q800_VIA1)
+DECLARE_INSTANCE_CHECKER(MOS6522Q800VIA1State, MOS6522_Q800_VIA1,
+ TYPE_MOS6522_Q800_VIA1)
struct MOS6522Q800VIA1State {
/*< private >*/
@@ -69,8 +69,8 @@ struct MOS6522Q800VIA1State {
#define TYPE_MOS6522_Q800_VIA2 "mos6522-q800-via2"
typedef struct MOS6522Q800VIA2State MOS6522Q800VIA2State;
-#define MOS6522_Q800_VIA2(obj) OBJECT_CHECK(MOS6522Q800VIA2State, (obj), \
- TYPE_MOS6522_Q800_VIA2)
+DECLARE_INSTANCE_CHECKER(MOS6522Q800VIA2State, MOS6522_Q800_VIA2,
+ TYPE_MOS6522_Q800_VIA2)
struct MOS6522Q800VIA2State {
/*< private >*/
@@ -80,7 +80,8 @@ struct MOS6522Q800VIA2State {
#define TYPE_MAC_VIA "mac_via"
typedef struct MacVIAState MacVIAState;
-#define MAC_VIA(obj) OBJECT_CHECK(MacVIAState, (obj), TYPE_MAC_VIA)
+DECLARE_INSTANCE_CHECKER(MacVIAState, MAC_VIA,
+ TYPE_MAC_VIA)
struct MacVIAState {
SysBusDevice busdev;
diff --git a/include/hw/misc/macio/cuda.h b/include/hw/misc/macio/cuda.h
index f2b0069262..e738b6376f 100644
--- a/include/hw/misc/macio/cuda.h
+++ b/include/hw/misc/macio/cuda.h
@@ -66,13 +66,14 @@ struct MOS6522CUDAState {
typedef struct MOS6522CUDAState MOS6522CUDAState;
#define TYPE_MOS6522_CUDA "mos6522-cuda"
-#define MOS6522_CUDA(obj) OBJECT_CHECK(MOS6522CUDAState, (obj), \
- TYPE_MOS6522_CUDA)
+DECLARE_INSTANCE_CHECKER(MOS6522CUDAState, MOS6522_CUDA,
+ TYPE_MOS6522_CUDA)
/* Cuda */
#define TYPE_CUDA "cuda"
typedef struct CUDAState CUDAState;
-#define CUDA(obj) OBJECT_CHECK(CUDAState, (obj), TYPE_CUDA)
+DECLARE_INSTANCE_CHECKER(CUDAState, CUDA,
+ TYPE_CUDA)
struct CUDAState {
/*< private >*/
diff --git a/include/hw/misc/macio/gpio.h b/include/hw/misc/macio/gpio.h
index 2234873250..1d0c8434ae 100644
--- a/include/hw/misc/macio/gpio.h
+++ b/include/hw/misc/macio/gpio.h
@@ -32,7 +32,8 @@
#define TYPE_MACIO_GPIO "macio-gpio"
typedef struct MacIOGPIOState MacIOGPIOState;
-#define MACIO_GPIO(obj) OBJECT_CHECK(MacIOGPIOState, (obj), TYPE_MACIO_GPIO)
+DECLARE_INSTANCE_CHECKER(MacIOGPIOState, MACIO_GPIO,
+ TYPE_MACIO_GPIO)
struct MacIOGPIOState {
/*< private >*/
diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h
index 81c28eeef7..02dbf37630 100644
--- a/include/hw/misc/macio/macio.h
+++ b/include/hw/misc/macio/macio.h
@@ -41,7 +41,8 @@
/* MacIO virtual bus */
#define TYPE_MACIO_BUS "macio-bus"
typedef struct MacIOBusState MacIOBusState;
-#define MACIO_BUS(obj) OBJECT_CHECK(MacIOBusState, (obj), TYPE_MACIO_BUS)
+DECLARE_INSTANCE_CHECKER(MacIOBusState, MACIO_BUS,
+ TYPE_MACIO_BUS)
struct MacIOBusState {
/*< private >*/
@@ -51,7 +52,8 @@ struct MacIOBusState {
/* MacIO IDE */
#define TYPE_MACIO_IDE "macio-ide"
typedef struct MACIOIDEState MACIOIDEState;
-#define MACIO_IDE(obj) OBJECT_CHECK(MACIOIDEState, (obj), TYPE_MACIO_IDE)
+DECLARE_INSTANCE_CHECKER(MACIOIDEState, MACIO_IDE,
+ TYPE_MACIO_IDE)
struct MACIOIDEState {
/*< private >*/
@@ -78,7 +80,8 @@ void macio_ide_register_dma(MACIOIDEState *ide);
#define TYPE_MACIO "macio"
typedef struct MacIOState MacIOState;
-#define MACIO(obj) OBJECT_CHECK(MacIOState, (obj), TYPE_MACIO)
+DECLARE_INSTANCE_CHECKER(MacIOState, MACIO,
+ TYPE_MACIO)
struct MacIOState {
/*< private >*/
@@ -96,8 +99,8 @@ struct MacIOState {
#define TYPE_OLDWORLD_MACIO "macio-oldworld"
typedef struct OldWorldMacIOState OldWorldMacIOState;
-#define OLDWORLD_MACIO(obj) \
- OBJECT_CHECK(OldWorldMacIOState, (obj), TYPE_OLDWORLD_MACIO)
+DECLARE_INSTANCE_CHECKER(OldWorldMacIOState, OLDWORLD_MACIO,
+ TYPE_OLDWORLD_MACIO)
struct OldWorldMacIOState {
/*< private >*/
@@ -112,8 +115,8 @@ struct OldWorldMacIOState {
#define TYPE_NEWWORLD_MACIO "macio-newworld"
typedef struct NewWorldMacIOState NewWorldMacIOState;
-#define NEWWORLD_MACIO(obj) \
- OBJECT_CHECK(NewWorldMacIOState, (obj), TYPE_NEWWORLD_MACIO)
+DECLARE_INSTANCE_CHECKER(NewWorldMacIOState, NEWWORLD_MACIO,
+ TYPE_NEWWORLD_MACIO)
struct NewWorldMacIOState {
/*< private >*/
diff --git a/include/hw/misc/macio/pmu.h b/include/hw/misc/macio/pmu.h
index b3982f6f32..0d1a5c1406 100644
--- a/include/hw/misc/macio/pmu.h
+++ b/include/hw/misc/macio/pmu.h
@@ -181,8 +181,8 @@ struct MOS6522PMUState {
typedef struct MOS6522PMUState MOS6522PMUState;
#define TYPE_MOS6522_PMU "mos6522-pmu"
-#define MOS6522_PMU(obj) OBJECT_CHECK(MOS6522PMUState, (obj), \
- TYPE_MOS6522_PMU)
+DECLARE_INSTANCE_CHECKER(MOS6522PMUState, MOS6522_PMU,
+ TYPE_MOS6522_PMU)
/**
* PMUState:
* @last_b: last value of B register
@@ -234,6 +234,7 @@ struct PMUState {
typedef struct PMUState PMUState;
#define TYPE_VIA_PMU "via-pmu"
-#define VIA_PMU(obj) OBJECT_CHECK(PMUState, (obj), TYPE_VIA_PMU)
+DECLARE_INSTANCE_CHECKER(PMUState, VIA_PMU,
+ TYPE_VIA_PMU)
#endif /* PMU_H */
diff --git a/include/hw/misc/max111x.h b/include/hw/misc/max111x.h
index e903a1af9c..6350a3f7c0 100644
--- a/include/hw/misc/max111x.h
+++ b/include/hw/misc/max111x.h
@@ -49,8 +49,8 @@ typedef struct MAX111xState MAX111xState;
#define TYPE_MAX_111X "max111x"
-#define MAX_111X(obj) \
- OBJECT_CHECK(MAX111xState, (obj), TYPE_MAX_111X)
+DECLARE_INSTANCE_CHECKER(MAX111xState, MAX_111X,
+ TYPE_MAX_111X)
#define TYPE_MAX_1110 "max1110"
#define TYPE_MAX_1111 "max1111"
diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h
index a334be8edd..923df4f112 100644
--- a/include/hw/misc/mips_cmgcr.h
+++ b/include/hw/misc/mips_cmgcr.h
@@ -15,7 +15,8 @@
#define TYPE_MIPS_GCR "mips-gcr"
typedef struct MIPSGCRState MIPSGCRState;
-#define MIPS_GCR(obj) OBJECT_CHECK(MIPSGCRState, (obj), TYPE_MIPS_GCR)
+DECLARE_INSTANCE_CHECKER(MIPSGCRState, MIPS_GCR,
+ TYPE_MIPS_GCR)
#define GCR_BASE_ADDR 0x1fbf8000ULL
#define GCR_ADDRSPACE_SZ 0x8000
diff --git a/include/hw/misc/mips_cpc.h b/include/hw/misc/mips_cpc.h
index b0131e4a54..7dc188e8a2 100644
--- a/include/hw/misc/mips_cpc.h
+++ b/include/hw/misc/mips_cpc.h
@@ -36,7 +36,8 @@
#define TYPE_MIPS_CPC "mips-cpc"
typedef struct MIPSCPCState MIPSCPCState;
-#define MIPS_CPC(obj) OBJECT_CHECK(MIPSCPCState, (obj), TYPE_MIPS_CPC)
+DECLARE_INSTANCE_CHECKER(MIPSCPCState, MIPS_CPC,
+ TYPE_MIPS_CPC)
struct MIPSCPCState {
SysBusDevice parent_obj;
diff --git a/include/hw/misc/mips_itu.h b/include/hw/misc/mips_itu.h
index 9ddb04708a..7c19f61fbb 100644
--- a/include/hw/misc/mips_itu.h
+++ b/include/hw/misc/mips_itu.h
@@ -25,7 +25,8 @@
#define TYPE_MIPS_ITU "mips-itu"
typedef struct MIPSITUState MIPSITUState;
-#define MIPS_ITU(obj) OBJECT_CHECK(MIPSITUState, (obj), TYPE_MIPS_ITU)
+DECLARE_INSTANCE_CHECKER(MIPSITUState, MIPS_ITU,
+ TYPE_MIPS_ITU)
#define ITC_CELL_DEPTH_SHIFT 2
#define ITC_CELL_DEPTH (1u << ITC_CELL_DEPTH_SHIFT)
diff --git a/include/hw/misc/mos6522.h b/include/hw/misc/mos6522.h
index b099814879..f73271ba67 100644
--- a/include/hw/misc/mos6522.h
+++ b/include/hw/misc/mos6522.h
@@ -126,7 +126,8 @@ typedef struct MOS6522State MOS6522State;
#define TYPE_MOS6522 "mos6522"
typedef struct MOS6522DeviceClass MOS6522DeviceClass;
-#define MOS6522(obj) OBJECT_CHECK(MOS6522State, (obj), TYPE_MOS6522)
+DECLARE_OBJ_CHECKERS(MOS6522State, MOS6522DeviceClass,
+ MOS6522, TYPE_MOS6522)
struct MOS6522DeviceClass {
DeviceClass parent_class;
@@ -143,10 +144,6 @@ struct MOS6522DeviceClass {
uint64_t (*get_timer2_load_time)(MOS6522State *dev, MOS6522Timer *ti);
};
-#define MOS6522_CLASS(cls) \
- OBJECT_CLASS_CHECK(MOS6522DeviceClass, (cls), TYPE_MOS6522)
-#define MOS6522_GET_CLASS(obj) \
- OBJECT_GET_CLASS(MOS6522DeviceClass, (obj), TYPE_MOS6522)
extern const VMStateDescription vmstate_mos6522;
diff --git a/include/hw/misc/mps2-fpgaio.h b/include/hw/misc/mps2-fpgaio.h
index e844041bb0..991f5b731e 100644
--- a/include/hw/misc/mps2-fpgaio.h
+++ b/include/hw/misc/mps2-fpgaio.h
@@ -26,7 +26,8 @@
#define TYPE_MPS2_FPGAIO "mps2-fpgaio"
typedef struct MPS2FPGAIO MPS2FPGAIO;
-#define MPS2_FPGAIO(obj) OBJECT_CHECK(MPS2FPGAIO, (obj), TYPE_MPS2_FPGAIO)
+DECLARE_INSTANCE_CHECKER(MPS2FPGAIO, MPS2_FPGAIO,
+ TYPE_MPS2_FPGAIO)
struct MPS2FPGAIO {
/*< private >*/
diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h
index 10393c4e3a..445e268b1f 100644
--- a/include/hw/misc/mps2-scc.h
+++ b/include/hw/misc/mps2-scc.h
@@ -17,7 +17,8 @@
#define TYPE_MPS2_SCC "mps2-scc"
typedef struct MPS2SCC MPS2SCC;
-#define MPS2_SCC(obj) OBJECT_CHECK(MPS2SCC, (obj), TYPE_MPS2_SCC)
+DECLARE_INSTANCE_CHECKER(MPS2SCC, MPS2_SCC,
+ TYPE_MPS2_SCC)
#define NUM_OSCCLK 3
diff --git a/include/hw/misc/msf2-sysreg.h b/include/hw/misc/msf2-sysreg.h
index 6b5d03608a..625932354a 100644
--- a/include/hw/misc/msf2-sysreg.h
+++ b/include/hw/misc/msf2-sysreg.h
@@ -63,7 +63,8 @@ enum {
#define TYPE_MSF2_SYSREG "msf2-sysreg"
typedef struct MSF2SysregState MSF2SysregState;
-#define MSF2_SYSREG(obj) OBJECT_CHECK(MSF2SysregState, (obj), TYPE_MSF2_SYSREG)
+DECLARE_INSTANCE_CHECKER(MSF2SysregState, MSF2_SYSREG,
+ TYPE_MSF2_SYSREG)
struct MSF2SysregState {
SysBusDevice parent_obj;
diff --git a/include/hw/misc/nrf51_rng.h b/include/hw/misc/nrf51_rng.h
index 247f167100..7f2263a906 100644
--- a/include/hw/misc/nrf51_rng.h
+++ b/include/hw/misc/nrf51_rng.h
@@ -39,7 +39,8 @@
#include "qom/object.h"
#define TYPE_NRF51_RNG "nrf51_soc.rng"
typedef struct NRF51RNGState NRF51RNGState;
-#define NRF51_RNG(obj) OBJECT_CHECK(NRF51RNGState, (obj), TYPE_NRF51_RNG)
+DECLARE_INSTANCE_CHECKER(NRF51RNGState, NRF51_RNG,
+ TYPE_NRF51_RNG)
#define NRF51_RNG_SIZE 0x1000
diff --git a/include/hw/misc/pca9552.h b/include/hw/misc/pca9552.h
index ebf8425903..b6f4e264fe 100644
--- a/include/hw/misc/pca9552.h
+++ b/include/hw/misc/pca9552.h
@@ -15,7 +15,8 @@
#define TYPE_PCA9552 "pca9552"
#define TYPE_PCA955X "pca955x"
typedef struct PCA955xState PCA955xState;
-#define PCA955X(obj) OBJECT_CHECK(PCA955xState, (obj), TYPE_PCA955X)
+DECLARE_INSTANCE_CHECKER(PCA955xState, PCA955X,
+ TYPE_PCA955X)
#define PCA955X_NR_REGS 10
#define PCA955X_PIN_COUNT_MAX 16
diff --git a/include/hw/misc/stm32f2xx_syscfg.h b/include/hw/misc/stm32f2xx_syscfg.h
index ff7c976d66..82ccd7cc24 100644
--- a/include/hw/misc/stm32f2xx_syscfg.h
+++ b/include/hw/misc/stm32f2xx_syscfg.h
@@ -38,8 +38,8 @@
#define TYPE_STM32F2XX_SYSCFG "stm32f2xx-syscfg"
typedef struct STM32F2XXSyscfgState STM32F2XXSyscfgState;
-#define STM32F2XX_SYSCFG(obj) \
- OBJECT_CHECK(STM32F2XXSyscfgState, (obj), TYPE_STM32F2XX_SYSCFG)
+DECLARE_INSTANCE_CHECKER(STM32F2XXSyscfgState, STM32F2XX_SYSCFG,
+ TYPE_STM32F2XX_SYSCFG)
struct STM32F2XXSyscfgState {
/* <private> */
diff --git a/include/hw/misc/stm32f4xx_exti.h b/include/hw/misc/stm32f4xx_exti.h
index 7132615785..4987c286ed 100644
--- a/include/hw/misc/stm32f4xx_exti.h
+++ b/include/hw/misc/stm32f4xx_exti.h
@@ -38,8 +38,8 @@
#define TYPE_STM32F4XX_EXTI "stm32f4xx-exti"
typedef struct STM32F4xxExtiState STM32F4xxExtiState;
-#define STM32F4XX_EXTI(obj) \
- OBJECT_CHECK(STM32F4xxExtiState, (obj), TYPE_STM32F4XX_EXTI)
+DECLARE_INSTANCE_CHECKER(STM32F4xxExtiState, STM32F4XX_EXTI,
+ TYPE_STM32F4XX_EXTI)
#define NUM_GPIO_EVENT_IN_LINES 16
#define NUM_INTERRUPT_OUT_LINES 16
diff --git a/include/hw/misc/stm32f4xx_syscfg.h b/include/hw/misc/stm32f4xx_syscfg.h
index 78130cb9c3..c3d89d4536 100644
--- a/include/hw/misc/stm32f4xx_syscfg.h
+++ b/include/hw/misc/stm32f4xx_syscfg.h
@@ -39,8 +39,8 @@
#define TYPE_STM32F4XX_SYSCFG "stm32f4xx-syscfg"
typedef struct STM32F4xxSyscfgState STM32F4xxSyscfgState;
-#define STM32F4XX_SYSCFG(obj) \
- OBJECT_CHECK(STM32F4xxSyscfgState, (obj), TYPE_STM32F4XX_SYSCFG)
+DECLARE_INSTANCE_CHECKER(STM32F4xxSyscfgState, STM32F4XX_SYSCFG,
+ TYPE_STM32F4XX_SYSCFG)
#define SYSCFG_NUM_EXTICR 4
diff --git a/include/hw/misc/tz-mpc.h b/include/hw/misc/tz-mpc.h
index 2d3eae0834..34e45fdb97 100644
--- a/include/hw/misc/tz-mpc.h
+++ b/include/hw/misc/tz-mpc.h
@@ -36,7 +36,8 @@
#define TYPE_TZ_MPC "tz-mpc"
typedef struct TZMPC TZMPC;
-#define TZ_MPC(obj) OBJECT_CHECK(TZMPC, (obj), TYPE_TZ_MPC)
+DECLARE_INSTANCE_CHECKER(TZMPC, TZ_MPC,
+ TYPE_TZ_MPC)
#define TZ_NUM_PORTS 16
diff --git a/include/hw/misc/tz-msc.h b/include/hw/misc/tz-msc.h
index 3f719833a9..7169f330ff 100644
--- a/include/hw/misc/tz-msc.h
+++ b/include/hw/misc/tz-msc.h
@@ -56,7 +56,8 @@
#define TYPE_TZ_MSC "tz-msc"
typedef struct TZMSC TZMSC;
-#define TZ_MSC(obj) OBJECT_CHECK(TZMSC, (obj), TYPE_TZ_MSC)
+DECLARE_INSTANCE_CHECKER(TZMSC, TZ_MSC,
+ TYPE_TZ_MSC)
struct TZMSC {
/*< private >*/
diff --git a/include/hw/misc/tz-ppc.h b/include/hw/misc/tz-ppc.h
index 4646005fa5..b5251b715e 100644
--- a/include/hw/misc/tz-ppc.h
+++ b/include/hw/misc/tz-ppc.h
@@ -70,7 +70,8 @@
#define TYPE_TZ_PPC "tz-ppc"
typedef struct TZPPC TZPPC;
-#define TZ_PPC(obj) OBJECT_CHECK(TZPPC, (obj), TYPE_TZ_PPC)
+DECLARE_INSTANCE_CHECKER(TZPPC, TZ_PPC,
+ TYPE_TZ_PPC)
#define TZ_NUM_PORTS 16
diff --git a/include/hw/misc/unimp.h b/include/hw/misc/unimp.h
index 6c04c8a923..7c724bab94 100644
--- a/include/hw/misc/unimp.h
+++ b/include/hw/misc/unimp.h
@@ -16,8 +16,8 @@
#define TYPE_UNIMPLEMENTED_DEVICE "unimplemented-device"
typedef struct UnimplementedDeviceState UnimplementedDeviceState;
-#define UNIMPLEMENTED_DEVICE(obj) \
- OBJECT_CHECK(UnimplementedDeviceState, (obj), TYPE_UNIMPLEMENTED_DEVICE)
+DECLARE_INSTANCE_CHECKER(UnimplementedDeviceState, UNIMPLEMENTED_DEVICE,
+ TYPE_UNIMPLEMENTED_DEVICE)
struct UnimplementedDeviceState {
SysBusDevice parent_obj;
diff --git a/include/hw/misc/vmcoreinfo.h b/include/hw/misc/vmcoreinfo.h
index cf0e51f863..ebada6617a 100644
--- a/include/hw/misc/vmcoreinfo.h
+++ b/include/hw/misc/vmcoreinfo.h
@@ -18,7 +18,8 @@
#define VMCOREINFO_DEVICE "vmcoreinfo"
typedef struct VMCoreInfoState VMCoreInfoState;
-#define VMCOREINFO(obj) OBJECT_CHECK(VMCoreInfoState, (obj), VMCOREINFO_DEVICE)
+DECLARE_INSTANCE_CHECKER(VMCoreInfoState, VMCOREINFO,
+ VMCOREINFO_DEVICE)
typedef struct fw_cfg_vmcoreinfo FWCfgVMCoreInfo;
diff --git a/include/hw/misc/zynq-xadc.h b/include/hw/misc/zynq-xadc.h
index 7e9767c74f..052f47954f 100644
--- a/include/hw/misc/zynq-xadc.h
+++ b/include/hw/misc/zynq-xadc.h
@@ -25,8 +25,8 @@
#define TYPE_ZYNQ_XADC "xlnx,zynq-xadc"
typedef struct ZynqXADCState ZynqXADCState;
-#define ZYNQ_XADC(obj) \
- OBJECT_CHECK(ZynqXADCState, (obj), TYPE_ZYNQ_XADC)
+DECLARE_INSTANCE_CHECKER(ZynqXADCState, ZYNQ_XADC,
+ TYPE_ZYNQ_XADC)
struct ZynqXADCState {
/*< private >*/
diff --git a/include/hw/net/allwinner-sun8i-emac.h b/include/hw/net/allwinner-sun8i-emac.h
index bd38588885..89e56b815b 100644
--- a/include/hw/net/allwinner-sun8i-emac.h
+++ b/include/hw/net/allwinner-sun8i-emac.h
@@ -31,8 +31,8 @@
#define TYPE_AW_SUN8I_EMAC "allwinner-sun8i-emac"
typedef struct AwSun8iEmacState AwSun8iEmacState;
-#define AW_SUN8I_EMAC(obj) \
- OBJECT_CHECK(AwSun8iEmacState, (obj), TYPE_AW_SUN8I_EMAC)
+DECLARE_INSTANCE_CHECKER(AwSun8iEmacState, AW_SUN8I_EMAC,
+ TYPE_AW_SUN8I_EMAC)
/** @} */
diff --git a/include/hw/net/allwinner_emac.h b/include/hw/net/allwinner_emac.h
index e927082580..f5f5b67939 100644
--- a/include/hw/net/allwinner_emac.h
+++ b/include/hw/net/allwinner_emac.h
@@ -32,7 +32,8 @@
#define TYPE_AW_EMAC "allwinner-emac"
typedef struct AwEmacState AwEmacState;
-#define AW_EMAC(obj) OBJECT_CHECK(AwEmacState, (obj), TYPE_AW_EMAC)
+DECLARE_INSTANCE_CHECKER(AwEmacState, AW_EMAC,
+ TYPE_AW_EMAC)
/*
* Allwinner EMAC register list
diff --git a/include/hw/net/cadence_gem.h b/include/hw/net/cadence_gem.h
index 04fd59a525..dff1083738 100644
--- a/include/hw/net/cadence_gem.h
+++ b/include/hw/net/cadence_gem.h
@@ -28,7 +28,8 @@
#define TYPE_CADENCE_GEM "cadence_gem"
typedef struct CadenceGEMState CadenceGEMState;
-#define CADENCE_GEM(obj) OBJECT_CHECK(CadenceGEMState, (obj), TYPE_CADENCE_GEM)
+DECLARE_INSTANCE_CHECKER(CadenceGEMState, CADENCE_GEM,
+ TYPE_CADENCE_GEM)
#include "net/net.h"
#include "hw/sysbus.h"
diff --git a/include/hw/net/ftgmac100.h b/include/hw/net/ftgmac100.h
index 6371bf60ab..c6b1c11fca 100644
--- a/include/hw/net/ftgmac100.h
+++ b/include/hw/net/ftgmac100.h
@@ -13,7 +13,8 @@
#define TYPE_FTGMAC100 "ftgmac100"
typedef struct FTGMAC100State FTGMAC100State;
-#define FTGMAC100(obj) OBJECT_CHECK(FTGMAC100State, (obj), TYPE_FTGMAC100)
+DECLARE_INSTANCE_CHECKER(FTGMAC100State, FTGMAC100,
+ TYPE_FTGMAC100)
#include "hw/sysbus.h"
#include "net/net.h"
@@ -70,7 +71,8 @@ struct FTGMAC100State {
#define TYPE_ASPEED_MII "aspeed-mmi"
typedef struct AspeedMiiState AspeedMiiState;
-#define ASPEED_MII(obj) OBJECT_CHECK(AspeedMiiState, (obj), TYPE_ASPEED_MII)
+DECLARE_INSTANCE_CHECKER(AspeedMiiState, ASPEED_MII,
+ TYPE_ASPEED_MII)
/*
* AST2600 MII controller
diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h
index 4d6ac5e408..ffdbc304b6 100644
--- a/include/hw/net/imx_fec.h
+++ b/include/hw/net/imx_fec.h
@@ -27,7 +27,8 @@
#define TYPE_IMX_FEC "imx.fec"
typedef struct IMXFECState IMXFECState;
-#define IMX_FEC(obj) OBJECT_CHECK(IMXFECState, (obj), TYPE_IMX_FEC)
+DECLARE_INSTANCE_CHECKER(IMXFECState, IMX_FEC,
+ TYPE_IMX_FEC)
#define TYPE_IMX_ENET "imx.enet"
diff --git a/include/hw/net/lance.h b/include/hw/net/lance.h
index fe459ffea7..f645d6af67 100644
--- a/include/hw/net/lance.h
+++ b/include/hw/net/lance.h
@@ -36,8 +36,8 @@
#define TYPE_LANCE "lance"
typedef struct SysBusPCNetState SysBusPCNetState;
-#define SYSBUS_PCNET(obj) \
- OBJECT_CHECK(SysBusPCNetState, (obj), TYPE_LANCE)
+DECLARE_INSTANCE_CHECKER(SysBusPCNetState, SYSBUS_PCNET,
+ TYPE_LANCE)
struct SysBusPCNetState {
SysBusDevice parent_obj;
diff --git a/include/hw/net/lasi_82596.h b/include/hw/net/lasi_82596.h
index 141e0cc17a..7b62b04833 100644
--- a/include/hw/net/lasi_82596.h
+++ b/include/hw/net/lasi_82596.h
@@ -14,8 +14,8 @@
#define TYPE_LASI_82596 "lasi_82596"
typedef struct SysBusI82596State SysBusI82596State;
-#define SYSBUS_I82596(obj) \
- OBJECT_CHECK(SysBusI82596State, (obj), TYPE_LASI_82596)
+DECLARE_INSTANCE_CHECKER(SysBusI82596State, SYSBUS_I82596,
+ TYPE_LASI_82596)
struct SysBusI82596State {
SysBusDevice parent_obj;
diff --git a/include/hw/net/msf2-emac.h b/include/hw/net/msf2-emac.h
index 6aef711007..68194d798c 100644
--- a/include/hw/net/msf2-emac.h
+++ b/include/hw/net/msf2-emac.h
@@ -30,8 +30,8 @@
#define TYPE_MSS_EMAC "msf2-emac"
typedef struct MSF2EmacState MSF2EmacState;
-#define MSS_EMAC(obj) \
- OBJECT_CHECK(MSF2EmacState, (obj), TYPE_MSS_EMAC)
+DECLARE_INSTANCE_CHECKER(MSF2EmacState, MSS_EMAC,
+ TYPE_MSS_EMAC)
#define R_MAX (0x1a0 / 4)
#define PHY_MAX_REGS 32
diff --git a/include/hw/nmi.h b/include/hw/nmi.h
index 47fc036e74..fff41bebc6 100644
--- a/include/hw/nmi.h
+++ b/include/hw/nmi.h
@@ -27,10 +27,8 @@
#define TYPE_NMI "nmi"
typedef struct NMIClass NMIClass;
-#define NMI_CLASS(klass) \
- OBJECT_CLASS_CHECK(NMIClass, (klass), TYPE_NMI)
-#define NMI_GET_CLASS(obj) \
- OBJECT_GET_CLASS(NMIClass, (obj), TYPE_NMI)
+DECLARE_CLASS_CHECKERS(NMIClass, NMI,
+ TYPE_NMI)
#define NMI(obj) \
INTERFACE_CHECK(NMIState, (obj), TYPE_NMI)
diff --git a/include/hw/nubus/mac-nubus-bridge.h b/include/hw/nubus/mac-nubus-bridge.h
index 8407ad21f6..6856d7e095 100644
--- a/include/hw/nubus/mac-nubus-bridge.h
+++ b/include/hw/nubus/mac-nubus-bridge.h
@@ -14,8 +14,8 @@
#define TYPE_MAC_NUBUS_BRIDGE "mac-nubus-bridge"
typedef struct MacNubusState MacNubusState;
-#define MAC_NUBUS_BRIDGE(obj) OBJECT_CHECK(MacNubusState, (obj), \
- TYPE_MAC_NUBUS_BRIDGE)
+DECLARE_INSTANCE_CHECKER(MacNubusState, MAC_NUBUS_BRIDGE,
+ TYPE_MAC_NUBUS_BRIDGE)
struct MacNubusState {
SysBusDevice sysbus_dev;
diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h
index 226efb2ff7..9370f0d8f0 100644
--- a/include/hw/nubus/nubus.h
+++ b/include/hw/nubus/nubus.h
@@ -24,12 +24,13 @@
#define TYPE_NUBUS_DEVICE "nubus-device"
typedef struct NubusDevice NubusDevice;
-#define NUBUS_DEVICE(obj) \
- OBJECT_CHECK(NubusDevice, (obj), TYPE_NUBUS_DEVICE)
+DECLARE_INSTANCE_CHECKER(NubusDevice, NUBUS_DEVICE,
+ TYPE_NUBUS_DEVICE)
#define TYPE_NUBUS_BUS "nubus-bus"
typedef struct NubusBus NubusBus;
-#define NUBUS_BUS(obj) OBJECT_CHECK(NubusBus, (obj), TYPE_NUBUS_BUS)
+DECLARE_INSTANCE_CHECKER(NubusBus, NUBUS_BUS,
+ TYPE_NUBUS_BUS)
#define TYPE_NUBUS_BRIDGE "nubus-bridge"
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
index 5e00fdc21e..f85393400c 100644
--- a/include/hw/nvram/fw_cfg.h
+++ b/include/hw/nvram/fw_cfg.h
@@ -12,17 +12,16 @@
#define TYPE_FW_CFG_MEM "fw_cfg_mem"
#define TYPE_FW_CFG_DATA_GENERATOR_INTERFACE "fw_cfg-data-generator"
-#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG)
-#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO)
-#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM)
+DECLARE_INSTANCE_CHECKER(FWCfgState, FW_CFG,
+ TYPE_FW_CFG)
+DECLARE_INSTANCE_CHECKER(FWCfgIoState, FW_CFG_IO,
+ TYPE_FW_CFG_IO)
+DECLARE_INSTANCE_CHECKER(FWCfgMemState, FW_CFG_MEM,
+ TYPE_FW_CFG_MEM)
typedef struct FWCfgDataGeneratorClass FWCfgDataGeneratorClass;
-#define FW_CFG_DATA_GENERATOR_CLASS(class) \
- OBJECT_CLASS_CHECK(FWCfgDataGeneratorClass, (class), \
+DECLARE_CLASS_CHECKERS(FWCfgDataGeneratorClass, FW_CFG_DATA_GENERATOR,
TYPE_FW_CFG_DATA_GENERATOR_INTERFACE)
-#define FW_CFG_DATA_GENERATOR_GET_CLASS(obj) \
- OBJECT_GET_CLASS(FWCfgDataGeneratorClass, (obj), \
- TYPE_FW_CFG_DATA_GENERATOR_INTERFACE)
struct FWCfgDataGeneratorClass {
/*< private >*/
diff --git a/include/hw/nvram/nrf51_nvm.h b/include/hw/nvram/nrf51_nvm.h
index 48871667f1..ab99b09206 100644
--- a/include/hw/nvram/nrf51_nvm.h
+++ b/include/hw/nvram/nrf51_nvm.h
@@ -26,7 +26,8 @@
#include "qom/object.h"
#define TYPE_NRF51_NVM "nrf51_soc.nvm"
typedef struct NRF51NVMState NRF51NVMState;
-#define NRF51_NVM(obj) OBJECT_CHECK(NRF51NVMState, (obj), TYPE_NRF51_NVM)
+DECLARE_INSTANCE_CHECKER(NRF51NVMState, NRF51_NVM,
+ TYPE_NRF51_NVM)
#define NRF51_UICR_FIXTURE_SIZE 64
diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h
index 0038bfbe3d..f2f0a27381 100644
--- a/include/hw/or-irq.h
+++ b/include/hw/or-irq.h
@@ -37,7 +37,8 @@
typedef struct OrIRQState qemu_or_irq;
-#define OR_IRQ(obj) OBJECT_CHECK(qemu_or_irq, (obj), TYPE_OR_IRQ)
+DECLARE_INSTANCE_CHECKER(qemu_or_irq, OR_IRQ,
+ TYPE_OR_IRQ)
struct OrIRQState {
DeviceState parent_obj;
diff --git a/include/hw/pci-bridge/simba.h b/include/hw/pci-bridge/simba.h
index 300379b94d..675aa5a990 100644
--- a/include/hw/pci-bridge/simba.h
+++ b/include/hw/pci-bridge/simba.h
@@ -38,7 +38,7 @@ struct SimbaPCIBridge {
typedef struct SimbaPCIBridge SimbaPCIBridge;
#define TYPE_SIMBA_PCI_BRIDGE "pbm-bridge"
-#define SIMBA_PCI_BRIDGE(obj) \
- OBJECT_CHECK(SimbaPCIBridge, (obj), TYPE_SIMBA_PCI_BRIDGE)
+DECLARE_INSTANCE_CHECKER(SimbaPCIBridge, SIMBA_PCI_BRIDGE,
+ TYPE_SIMBA_PCI_BRIDGE)
#endif
diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h
index 43ee5b3a12..551eec3107 100644
--- a/include/hw/pci-host/designware.h
+++ b/include/hw/pci-host/designware.h
@@ -30,13 +30,13 @@
#define TYPE_DESIGNWARE_PCIE_HOST "designware-pcie-host"
typedef struct DesignwarePCIEHost DesignwarePCIEHost;
-#define DESIGNWARE_PCIE_HOST(obj) \
- OBJECT_CHECK(DesignwarePCIEHost, (obj), TYPE_DESIGNWARE_PCIE_HOST)
+DECLARE_INSTANCE_CHECKER(DesignwarePCIEHost, DESIGNWARE_PCIE_HOST,
+ TYPE_DESIGNWARE_PCIE_HOST)
#define TYPE_DESIGNWARE_PCIE_ROOT "designware-pcie-root"
typedef struct DesignwarePCIERoot DesignwarePCIERoot;
-#define DESIGNWARE_PCIE_ROOT(obj) \
- OBJECT_CHECK(DesignwarePCIERoot, (obj), TYPE_DESIGNWARE_PCIE_ROOT)
+DECLARE_INSTANCE_CHECKER(DesignwarePCIERoot, DESIGNWARE_PCIE_ROOT,
+ TYPE_DESIGNWARE_PCIE_ROOT)
struct DesignwarePCIERoot;
diff --git a/include/hw/pci-host/gpex.h b/include/hw/pci-host/gpex.h
index d70e1c69dc..e8432eced8 100644
--- a/include/hw/pci-host/gpex.h
+++ b/include/hw/pci-host/gpex.h
@@ -27,13 +27,13 @@
#define TYPE_GPEX_HOST "gpex-pcihost"
typedef struct GPEXHost GPEXHost;
-#define GPEX_HOST(obj) \
- OBJECT_CHECK(GPEXHost, (obj), TYPE_GPEX_HOST)
+DECLARE_INSTANCE_CHECKER(GPEXHost, GPEX_HOST,
+ TYPE_GPEX_HOST)
#define TYPE_GPEX_ROOT_DEVICE "gpex-root"
typedef struct GPEXRootState GPEXRootState;
-#define MCH_PCI_DEVICE(obj) \
- OBJECT_CHECK(GPEXRootState, (obj), TYPE_GPEX_ROOT_DEVICE)
+DECLARE_INSTANCE_CHECKER(GPEXRootState, MCH_PCI_DEVICE,
+ TYPE_GPEX_ROOT_DEVICE)
#define GPEX_NUM_IRQS 4
diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
index 74fe300bff..046c64576d 100644
--- a/include/hw/pci-host/i440fx.h
+++ b/include/hw/pci-host/i440fx.h
@@ -20,8 +20,8 @@
#define TYPE_I440FX_PCI_DEVICE "i440FX"
typedef struct PCII440FXState PCII440FXState;
-#define I440FX_PCI_DEVICE(obj) \
- OBJECT_CHECK(PCII440FXState, (obj), TYPE_I440FX_PCI_DEVICE)
+DECLARE_INSTANCE_CHECKER(PCII440FXState, I440FX_PCI_DEVICE,
+ TYPE_I440FX_PCI_DEVICE)
struct PCII440FXState {
/*< private >*/
diff --git a/include/hw/pci-host/pnv_phb3.h b/include/hw/pci-host/pnv_phb3.h
index 43f9e873ae..182f29d681 100644
--- a/include/hw/pci-host/pnv_phb3.h
+++ b/include/hw/pci-host/pnv_phb3.h
@@ -22,7 +22,8 @@ typedef struct PnvPHB3 PnvPHB3;
*/
#define TYPE_PHB3_MSI "phb3-msi"
typedef struct Phb3MsiState Phb3MsiState;
-#define PHB3_MSI(obj) OBJECT_CHECK(Phb3MsiState, (obj), TYPE_PHB3_MSI)
+DECLARE_INSTANCE_CHECKER(Phb3MsiState, PHB3_MSI,
+ TYPE_PHB3_MSI)
#define PHB3_MAX_MSI 2048
@@ -72,7 +73,8 @@ typedef struct PnvPhb3DMASpace {
*/
#define TYPE_PNV_PBCQ "pnv-pbcq"
typedef struct PnvPBCQState PnvPBCQState;
-#define PNV_PBCQ(obj) OBJECT_CHECK(PnvPBCQState, (obj), TYPE_PNV_PBCQ)
+DECLARE_INSTANCE_CHECKER(PnvPBCQState, PNV_PBCQ,
+ TYPE_PNV_PBCQ)
struct PnvPBCQState {
DeviceState parent;
@@ -116,7 +118,8 @@ typedef struct PnvPHB3RootPort {
* PHB3 PCIe Host Bridge for PowerNV machines (POWER8)
*/
#define TYPE_PNV_PHB3 "pnv-phb3"
-#define PNV_PHB3(obj) OBJECT_CHECK(PnvPHB3, (obj), TYPE_PNV_PHB3)
+DECLARE_INSTANCE_CHECKER(PnvPHB3, PNV_PHB3,
+ TYPE_PNV_PHB3)
#define PNV_PHB3_NUM_M64 16
#define PNV_PHB3_NUM_REGS (0x1000 >> 3)
diff --git a/include/hw/pci-host/pnv_phb4.h b/include/hw/pci-host/pnv_phb4.h
index 450602cb72..15a4633178 100644
--- a/include/hw/pci-host/pnv_phb4.h
+++ b/include/hw/pci-host/pnv_phb4.h
@@ -58,7 +58,8 @@ typedef struct PnvPHB4RootPort {
* PHB4 PCIe Host Bridge for PowerNV machines (POWER9)
*/
#define TYPE_PNV_PHB4 "pnv-phb4"
-#define PNV_PHB4(obj) OBJECT_CHECK(PnvPHB4, (obj), TYPE_PNV_PHB4)
+DECLARE_INSTANCE_CHECKER(PnvPHB4, PNV_PHB4,
+ TYPE_PNV_PHB4)
#define PNV_PHB4_MAX_LSIs 8
#define PNV_PHB4_MAX_INTs 4096
@@ -142,12 +143,12 @@ extern const MemoryRegionOps pnv_phb4_xscom_ops;
*/
#define TYPE_PNV_PHB4_PEC "pnv-phb4-pec"
typedef struct PnvPhb4PecClass PnvPhb4PecClass;
-#define PNV_PHB4_PEC(obj) \
- OBJECT_CHECK(PnvPhb4PecState, (obj), TYPE_PNV_PHB4_PEC)
+DECLARE_OBJ_CHECKERS(PnvPhb4PecState, PnvPhb4PecClass,
+ PNV_PHB4_PEC, TYPE_PNV_PHB4_PEC)
#define TYPE_PNV_PHB4_PEC_STACK "pnv-phb4-pec-stack"
-#define PNV_PHB4_PEC_STACK(obj) \
- OBJECT_CHECK(PnvPhb4PecStack, (obj), TYPE_PNV_PHB4_PEC_STACK)
+DECLARE_INSTANCE_CHECKER(PnvPhb4PecStack, PNV_PHB4_PEC_STACK,
+ TYPE_PNV_PHB4_PEC_STACK)
/* Per-stack data */
struct PnvPhb4PecStack {
@@ -211,10 +212,6 @@ struct PnvPhb4PecState {
PnvPhb4PecStack stacks[PHB4_PEC_MAX_STACKS];
};
-#define PNV_PHB4_PEC_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvPhb4PecClass, (klass), TYPE_PNV_PHB4_PEC)
-#define PNV_PHB4_PEC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvPhb4PecClass, (obj), TYPE_PNV_PHB4_PEC)
struct PnvPhb4PecClass {
DeviceClass parent_class;
diff --git a/include/hw/pci-host/q35.h b/include/hw/pci-host/q35.h
index 5db5a763d4..0f5a534f77 100644
--- a/include/hw/pci-host/q35.h
+++ b/include/hw/pci-host/q35.h
@@ -31,13 +31,13 @@
#define TYPE_Q35_HOST_DEVICE "q35-pcihost"
typedef struct Q35PCIHost Q35PCIHost;
-#define Q35_HOST_DEVICE(obj) \
- OBJECT_CHECK(Q35PCIHost, (obj), TYPE_Q35_HOST_DEVICE)
+DECLARE_INSTANCE_CHECKER(Q35PCIHost, Q35_HOST_DEVICE,
+ TYPE_Q35_HOST_DEVICE)
#define TYPE_MCH_PCI_DEVICE "mch"
typedef struct MCHPCIState MCHPCIState;
-#define MCH_PCI_DEVICE(obj) \
- OBJECT_CHECK(MCHPCIState, (obj), TYPE_MCH_PCI_DEVICE)
+DECLARE_INSTANCE_CHECKER(MCHPCIState, MCH_PCI_DEVICE,
+ TYPE_MCH_PCI_DEVICE)
struct MCHPCIState {
/*< private >*/
diff --git a/include/hw/pci-host/sabre.h b/include/hw/pci-host/sabre.h
index 5fb508e9ce..597bf70d69 100644
--- a/include/hw/pci-host/sabre.h
+++ b/include/hw/pci-host/sabre.h
@@ -23,8 +23,8 @@ struct SabrePCIState {
typedef struct SabrePCIState SabrePCIState;
#define TYPE_SABRE_PCI_DEVICE "sabre-pci"
-#define SABRE_PCI_DEVICE(obj) \
- OBJECT_CHECK(SabrePCIState, (obj), TYPE_SABRE_PCI_DEVICE)
+DECLARE_INSTANCE_CHECKER(SabrePCIState, SABRE_PCI_DEVICE,
+ TYPE_SABRE_PCI_DEVICE)
struct SabreState {
PCIHostState parent_obj;
@@ -51,7 +51,7 @@ struct SabreState {
typedef struct SabreState SabreState;
#define TYPE_SABRE "sabre"
-#define SABRE_DEVICE(obj) \
- OBJECT_CHECK(SabreState, (obj), TYPE_SABRE)
+DECLARE_INSTANCE_CHECKER(SabreState, SABRE_DEVICE,
+ TYPE_SABRE)
#endif
diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h
index 783e8905df..0431ce1048 100644
--- a/include/hw/pci-host/spapr.h
+++ b/include/hw/pci-host/spapr.h
@@ -29,8 +29,8 @@
#define TYPE_SPAPR_PCI_HOST_BRIDGE "spapr-pci-host-bridge"
typedef struct SpaprPhbState SpaprPhbState;
-#define SPAPR_PCI_HOST_BRIDGE(obj) \
- OBJECT_CHECK(SpaprPhbState, (obj), TYPE_SPAPR_PCI_HOST_BRIDGE)
+DECLARE_INSTANCE_CHECKER(SpaprPhbState, SPAPR_PCI_HOST_BRIDGE,
+ TYPE_SPAPR_PCI_HOST_BRIDGE)
#define SPAPR_PCI_DMA_MAX_WINDOWS 2
diff --git a/include/hw/pci-host/uninorth.h b/include/hw/pci-host/uninorth.h
index a1f3aaaecd..d10c598298 100644
--- a/include/hw/pci-host/uninorth.h
+++ b/include/hw/pci-host/uninorth.h
@@ -38,14 +38,14 @@
#define TYPE_U3_AGP_HOST_BRIDGE "u3-agp-pcihost"
typedef struct UNINHostState UNINHostState;
-#define UNI_NORTH_PCI_HOST_BRIDGE(obj) \
- OBJECT_CHECK(UNINHostState, (obj), TYPE_UNI_NORTH_PCI_HOST_BRIDGE)
-#define UNI_NORTH_AGP_HOST_BRIDGE(obj) \
- OBJECT_CHECK(UNINHostState, (obj), TYPE_UNI_NORTH_AGP_HOST_BRIDGE)
-#define UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE(obj) \
- OBJECT_CHECK(UNINHostState, (obj), TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE)
-#define U3_AGP_HOST_BRIDGE(obj) \
- OBJECT_CHECK(UNINHostState, (obj), TYPE_U3_AGP_HOST_BRIDGE)
+DECLARE_INSTANCE_CHECKER(UNINHostState, UNI_NORTH_PCI_HOST_BRIDGE,
+ TYPE_UNI_NORTH_PCI_HOST_BRIDGE)
+DECLARE_INSTANCE_CHECKER(UNINHostState, UNI_NORTH_AGP_HOST_BRIDGE,
+ TYPE_UNI_NORTH_AGP_HOST_BRIDGE)
+DECLARE_INSTANCE_CHECKER(UNINHostState, UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE,
+ TYPE_UNI_NORTH_INTERNAL_PCI_HOST_BRIDGE)
+DECLARE_INSTANCE_CHECKER(UNINHostState, U3_AGP_HOST_BRIDGE,
+ TYPE_U3_AGP_HOST_BRIDGE)
struct UNINHostState {
PCIHostState parent_obj;
@@ -66,7 +66,7 @@ struct UNINState {
typedef struct UNINState UNINState;
#define TYPE_UNI_NORTH "uni-north"
-#define UNI_NORTH(obj) \
- OBJECT_CHECK(UNINState, (obj), TYPE_UNI_NORTH)
+DECLARE_INSTANCE_CHECKER(UNINState, UNI_NORTH,
+ TYPE_UNI_NORTH)
#endif /* UNINORTH_H */
diff --git a/include/hw/pci-host/xilinx-pcie.h b/include/hw/pci-host/xilinx-pcie.h
index 1cbd6d2f79..6058c8c9e2 100644
--- a/include/hw/pci-host/xilinx-pcie.h
+++ b/include/hw/pci-host/xilinx-pcie.h
@@ -28,13 +28,13 @@
#define TYPE_XILINX_PCIE_HOST "xilinx-pcie-host"
typedef struct XilinxPCIEHost XilinxPCIEHost;
-#define XILINX_PCIE_HOST(obj) \
- OBJECT_CHECK(XilinxPCIEHost, (obj), TYPE_XILINX_PCIE_HOST)
+DECLARE_INSTANCE_CHECKER(XilinxPCIEHost, XILINX_PCIE_HOST,
+ TYPE_XILINX_PCIE_HOST)
#define TYPE_XILINX_PCIE_ROOT "xilinx-pcie-root"
typedef struct XilinxPCIERoot XilinxPCIERoot;
-#define XILINX_PCIE_ROOT(obj) \
- OBJECT_CHECK(XilinxPCIERoot, (obj), TYPE_XILINX_PCIE_ROOT)
+DECLARE_INSTANCE_CHECKER(XilinxPCIERoot, XILINX_PCIE_ROOT,
+ TYPE_XILINX_PCIE_ROOT)
struct XilinxPCIERoot {
PCIBridge parent_obj;
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index be9e298dba..c13ae1f858 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -197,12 +197,8 @@ enum {
#define TYPE_PCI_DEVICE "pci-device"
typedef struct PCIDeviceClass PCIDeviceClass;
-#define PCI_DEVICE(obj) \
- OBJECT_CHECK(PCIDevice, (obj), TYPE_PCI_DEVICE)
-#define PCI_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PCIDeviceClass, (klass), TYPE_PCI_DEVICE)
-#define PCI_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PCIDeviceClass, (obj), TYPE_PCI_DEVICE)
+DECLARE_OBJ_CHECKERS(PCIDevice, PCIDeviceClass,
+ PCI_DEVICE, TYPE_PCI_DEVICE)
/* Implemented by devices that can be plugged on PCI Express buses */
#define INTERFACE_PCIE_DEVICE "pci-express-device"
@@ -399,9 +395,8 @@ typedef PCIINTxRoute (*pci_route_irq_fn)(void *opaque, int pin);
#define TYPE_PCI_BUS "PCI"
typedef struct PCIBusClass PCIBusClass;
-#define PCI_BUS(obj) OBJECT_CHECK(PCIBus, (obj), TYPE_PCI_BUS)
-#define PCI_BUS_CLASS(klass) OBJECT_CLASS_CHECK(PCIBusClass, (klass), TYPE_PCI_BUS)
-#define PCI_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(PCIBusClass, (obj), TYPE_PCI_BUS)
+DECLARE_OBJ_CHECKERS(PCIBus, PCIBusClass,
+ PCI_BUS, TYPE_PCI_BUS)
#define TYPE_PCIE_BUS "PCIE"
bool pci_bus_is_express(PCIBus *bus);
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index b46d37faa8..7ab145955a 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -51,7 +51,8 @@ struct PCIBridgeWindows {
};
#define TYPE_PCI_BRIDGE "base-pci-bridge"
-#define PCI_BRIDGE(obj) OBJECT_CHECK(PCIBridge, (obj), TYPE_PCI_BRIDGE)
+DECLARE_INSTANCE_CHECKER(PCIBridge, PCI_BRIDGE,
+ TYPE_PCI_BRIDGE)
struct PCIBridge {
/*< private >*/
diff --git a/include/hw/pci/pci_host.h b/include/hw/pci/pci_host.h
index 51ea53908f..d1fc1c3604 100644
--- a/include/hw/pci/pci_host.h
+++ b/include/hw/pci/pci_host.h
@@ -33,12 +33,8 @@
#define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
typedef struct PCIHostBridgeClass PCIHostBridgeClass;
-#define PCI_HOST_BRIDGE(obj) \
- OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST_BRIDGE)
-#define PCI_HOST_BRIDGE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PCIHostBridgeClass, (klass), TYPE_PCI_HOST_BRIDGE)
-#define PCI_HOST_BRIDGE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PCIHostBridgeClass, (obj), TYPE_PCI_HOST_BRIDGE)
+DECLARE_OBJ_CHECKERS(PCIHostState, PCIHostBridgeClass,
+ PCI_HOST_BRIDGE, TYPE_PCI_HOST_BRIDGE)
struct PCIHostState {
SysBusDevice busdev;
diff --git a/include/hw/pci/pcie_host.h b/include/hw/pci/pcie_host.h
index c7d2ae5bf4..f512646c0c 100644
--- a/include/hw/pci/pcie_host.h
+++ b/include/hw/pci/pcie_host.h
@@ -26,8 +26,8 @@
#include "qom/object.h"
#define TYPE_PCIE_HOST_BRIDGE "pcie-host-bridge"
-#define PCIE_HOST_BRIDGE(obj) \
- OBJECT_CHECK(PCIExpressHost, (obj), TYPE_PCIE_HOST_BRIDGE)
+DECLARE_INSTANCE_CHECKER(PCIExpressHost, PCIE_HOST_BRIDGE,
+ TYPE_PCIE_HOST_BRIDGE)
#define PCIE_HOST_MCFG_BASE "MCFG"
#define PCIE_HOST_MCFG_SIZE "mcfg_size"
diff --git a/include/hw/pci/pcie_port.h b/include/hw/pci/pcie_port.h
index 765399159f..2463c07fa7 100644
--- a/include/hw/pci/pcie_port.h
+++ b/include/hw/pci/pcie_port.h
@@ -26,7 +26,8 @@
#include "qom/object.h"
#define TYPE_PCIE_PORT "pcie-port"
-#define PCIE_PORT(obj) OBJECT_CHECK(PCIEPort, (obj), TYPE_PCIE_PORT)
+DECLARE_INSTANCE_CHECKER(PCIEPort, PCIE_PORT,
+ TYPE_PCIE_PORT)
struct PCIEPort {
/*< private >*/
@@ -40,7 +41,8 @@ struct PCIEPort {
void pcie_port_init_reg(PCIDevice *d);
#define TYPE_PCIE_SLOT "pcie-slot"
-#define PCIE_SLOT(obj) OBJECT_CHECK(PCIESlot, (obj), TYPE_PCIE_SLOT)
+DECLARE_INSTANCE_CHECKER(PCIESlot, PCIE_SLOT,
+ TYPE_PCIE_SLOT)
struct PCIESlot {
/*< private >*/
@@ -69,10 +71,8 @@ void pcie_chassis_del_slot(PCIESlot *s);
#define TYPE_PCIE_ROOT_PORT "pcie-root-port-base"
typedef struct PCIERootPortClass PCIERootPortClass;
-#define PCIE_ROOT_PORT_CLASS(klass) \
- OBJECT_CLASS_CHECK(PCIERootPortClass, (klass), TYPE_PCIE_ROOT_PORT)
-#define PCIE_ROOT_PORT_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PCIERootPortClass, (obj), TYPE_PCIE_ROOT_PORT)
+DECLARE_CLASS_CHECKERS(PCIERootPortClass, PCIE_ROOT_PORT,
+ TYPE_PCIE_ROOT_PORT)
struct PCIERootPortClass {
PCIDeviceClass parent_class;
diff --git a/include/hw/pcmcia.h b/include/hw/pcmcia.h
index 0f9e41db02..fb40ae7e09 100644
--- a/include/hw/pcmcia.h
+++ b/include/hw/pcmcia.h
@@ -14,12 +14,8 @@ typedef struct PCMCIASocket {
#define TYPE_PCMCIA_CARD "pcmcia-card"
typedef struct PCMCIACardClass PCMCIACardClass;
typedef struct PCMCIACardState PCMCIACardState;
-#define PCMCIA_CARD(obj) \
- OBJECT_CHECK(PCMCIACardState, (obj), TYPE_PCMCIA_CARD)
-#define PCMCIA_CARD_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PCMCIACardClass, obj, TYPE_PCMCIA_CARD)
-#define PCMCIA_CARD_CLASS(cls) \
- OBJECT_CLASS_CHECK(PCMCIACardClass, cls, TYPE_PCMCIA_CARD)
+DECLARE_OBJ_CHECKERS(PCMCIACardState, PCMCIACardClass,
+ PCMCIA_CARD, TYPE_PCMCIA_CARD)
struct PCMCIACardState {
/*< private >*/
diff --git a/include/hw/platform-bus.h b/include/hw/platform-bus.h
index cda1346a4f..0d035e1b71 100644
--- a/include/hw/platform-bus.h
+++ b/include/hw/platform-bus.h
@@ -28,8 +28,8 @@
typedef struct PlatformBusDevice PlatformBusDevice;
#define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device"
-#define PLATFORM_BUS_DEVICE(obj) \
- OBJECT_CHECK(PlatformBusDevice, (obj), TYPE_PLATFORM_BUS_DEVICE)
+DECLARE_INSTANCE_CHECKER(PlatformBusDevice, PLATFORM_BUS_DEVICE,
+ TYPE_PLATFORM_BUS_DEVICE)
struct PlatformBusDevice {
/*< private >*/
diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h
index e1f42cdbd3..9166d5f758 100644
--- a/include/hw/ppc/mac_dbdma.h
+++ b/include/hw/ppc/mac_dbdma.h
@@ -178,6 +178,7 @@ void DBDMA_register_channel(void *dbdma, int nchan, qemu_irq irq,
void DBDMA_kick(DBDMAState *dbdma);
#define TYPE_MAC_DBDMA "mac-dbdma"
-#define MAC_DBDMA(obj) OBJECT_CHECK(DBDMAState, (obj), TYPE_MAC_DBDMA)
+DECLARE_INSTANCE_CHECKER(DBDMAState, MAC_DBDMA,
+ TYPE_MAC_DBDMA)
#endif
diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h
index 81a0b3b1ee..61908c7858 100644
--- a/include/hw/ppc/openpic.h
+++ b/include/hw/ppc/openpic.h
@@ -138,7 +138,8 @@ typedef struct IRQDest {
#define TYPE_OPENPIC "openpic"
typedef struct OpenPICState OpenPICState;
-#define OPENPIC(obj) OBJECT_CHECK(OpenPICState, (obj), TYPE_OPENPIC)
+DECLARE_INSTANCE_CHECKER(OpenPICState, OPENPIC,
+ TYPE_OPENPIC)
struct OpenPICState {
/*< private >*/
diff --git a/include/hw/ppc/pnv.h b/include/hw/ppc/pnv.h
index 64f9ee8867..f3bacb6a5c 100644
--- a/include/hw/ppc/pnv.h
+++ b/include/hw/ppc/pnv.h
@@ -37,11 +37,8 @@
#define TYPE_PNV_CHIP "pnv-chip"
typedef struct PnvChip PnvChip;
typedef struct PnvChipClass PnvChipClass;
-#define PNV_CHIP(obj) OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP)
-#define PNV_CHIP_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvChipClass, (klass), TYPE_PNV_CHIP)
-#define PNV_CHIP_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvChipClass, (obj), TYPE_PNV_CHIP)
+DECLARE_OBJ_CHECKERS(PnvChip, PnvChipClass,
+ PNV_CHIP, TYPE_PNV_CHIP)
struct PnvChip {
/*< private >*/
@@ -68,7 +65,8 @@ struct PnvChip {
#define TYPE_PNV8_CHIP "pnv8-chip"
typedef struct Pnv8Chip Pnv8Chip;
-#define PNV8_CHIP(obj) OBJECT_CHECK(Pnv8Chip, (obj), TYPE_PNV8_CHIP)
+DECLARE_INSTANCE_CHECKER(Pnv8Chip, PNV8_CHIP,
+ TYPE_PNV8_CHIP)
struct Pnv8Chip {
/*< private >*/
@@ -90,7 +88,8 @@ struct Pnv8Chip {
#define TYPE_PNV9_CHIP "pnv9-chip"
typedef struct Pnv9Chip Pnv9Chip;
-#define PNV9_CHIP(obj) OBJECT_CHECK(Pnv9Chip, (obj), TYPE_PNV9_CHIP)
+DECLARE_INSTANCE_CHECKER(Pnv9Chip, PNV9_CHIP,
+ TYPE_PNV9_CHIP)
struct Pnv9Chip {
/*< private >*/
@@ -118,7 +117,8 @@ struct Pnv9Chip {
#define TYPE_PNV10_CHIP "pnv10-chip"
typedef struct Pnv10Chip Pnv10Chip;
-#define PNV10_CHIP(obj) OBJECT_CHECK(Pnv10Chip, (obj), TYPE_PNV10_CHIP)
+DECLARE_INSTANCE_CHECKER(Pnv10Chip, PNV10_CHIP,
+ TYPE_PNV10_CHIP)
struct Pnv10Chip {
/*< private >*/
@@ -156,24 +156,24 @@ struct PnvChipClass {
#define PNV_CHIP_TYPE_NAME(cpu_model) cpu_model PNV_CHIP_TYPE_SUFFIX
#define TYPE_PNV_CHIP_POWER8E PNV_CHIP_TYPE_NAME("power8e_v2.1")
-#define PNV_CHIP_POWER8E(obj) \
- OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8E)
+DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER8E,
+ TYPE_PNV_CHIP_POWER8E)
#define TYPE_PNV_CHIP_POWER8 PNV_CHIP_TYPE_NAME("power8_v2.0")
-#define PNV_CHIP_POWER8(obj) \
- OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8)
+DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER8,
+ TYPE_PNV_CHIP_POWER8)
#define TYPE_PNV_CHIP_POWER8NVL PNV_CHIP_TYPE_NAME("power8nvl_v1.0")
-#define PNV_CHIP_POWER8NVL(obj) \
- OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER8NVL)
+DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER8NVL,
+ TYPE_PNV_CHIP_POWER8NVL)
#define TYPE_PNV_CHIP_POWER9 PNV_CHIP_TYPE_NAME("power9_v2.0")
-#define PNV_CHIP_POWER9(obj) \
- OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER9)
+DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER9,
+ TYPE_PNV_CHIP_POWER9)
#define TYPE_PNV_CHIP_POWER10 PNV_CHIP_TYPE_NAME("power10_v1.0")
-#define PNV_CHIP_POWER10(obj) \
- OBJECT_CHECK(PnvChip, (obj), TYPE_PNV_CHIP_POWER10)
+DECLARE_INSTANCE_CHECKER(PnvChip, PNV_CHIP_POWER10,
+ TYPE_PNV_CHIP_POWER10)
/*
* This generates a HW chip id depending on an index, as found on a
@@ -199,12 +199,8 @@ PowerPCCPU *pnv_chip_find_cpu(PnvChip *chip, uint32_t pir);
#define TYPE_PNV_MACHINE MACHINE_TYPE_NAME("powernv")
typedef struct PnvMachineClass PnvMachineClass;
typedef struct PnvMachineState PnvMachineState;
-#define PNV_MACHINE(obj) \
- OBJECT_CHECK(PnvMachineState, (obj), TYPE_PNV_MACHINE)
-#define PNV_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvMachineClass, obj, TYPE_PNV_MACHINE)
-#define PNV_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvMachineClass, klass, TYPE_PNV_MACHINE)
+DECLARE_OBJ_CHECKERS(PnvMachineState, PnvMachineClass,
+ PNV_MACHINE, TYPE_PNV_MACHINE)
struct PnvMachineClass {
diff --git a/include/hw/ppc/pnv_core.h b/include/hw/ppc/pnv_core.h
index 2d91a7d519..fd17a236e3 100644
--- a/include/hw/ppc/pnv_core.h
+++ b/include/hw/ppc/pnv_core.h
@@ -27,12 +27,8 @@
#define TYPE_PNV_CORE "powernv-cpu-core"
typedef struct PnvCore PnvCore;
typedef struct PnvCoreClass PnvCoreClass;
-#define PNV_CORE(obj) \
- OBJECT_CHECK(PnvCore, (obj), TYPE_PNV_CORE)
-#define PNV_CORE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvCoreClass, (klass), TYPE_PNV_CORE)
-#define PNV_CORE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvCoreClass, (obj), TYPE_PNV_CORE)
+DECLARE_OBJ_CHECKERS(PnvCore, PnvCoreClass,
+ PNV_CORE, TYPE_PNV_CORE)
typedef struct PnvChip PnvChip;
@@ -69,8 +65,8 @@ static inline PnvCPUState *pnv_cpu_state(PowerPCCPU *cpu)
#define TYPE_PNV_QUAD "powernv-cpu-quad"
typedef struct PnvQuad PnvQuad;
-#define PNV_QUAD(obj) \
- OBJECT_CHECK(PnvQuad, (obj), TYPE_PNV_QUAD)
+DECLARE_INSTANCE_CHECKER(PnvQuad, PNV_QUAD,
+ TYPE_PNV_QUAD)
struct PnvQuad {
DeviceState parent_obj;
diff --git a/include/hw/ppc/pnv_homer.h b/include/hw/ppc/pnv_homer.h
index bedba94e18..7aadcab03c 100644
--- a/include/hw/ppc/pnv_homer.h
+++ b/include/hw/ppc/pnv_homer.h
@@ -26,11 +26,14 @@
#define TYPE_PNV_HOMER "pnv-homer"
typedef struct PnvHomer PnvHomer;
typedef struct PnvHomerClass PnvHomerClass;
-#define PNV_HOMER(obj) OBJECT_CHECK(PnvHomer, (obj), TYPE_PNV_HOMER)
+DECLARE_OBJ_CHECKERS(PnvHomer, PnvHomerClass,
+ PNV_HOMER, TYPE_PNV_HOMER)
#define TYPE_PNV8_HOMER TYPE_PNV_HOMER "-POWER8"
-#define PNV8_HOMER(obj) OBJECT_CHECK(PnvHomer, (obj), TYPE_PNV8_HOMER)
+DECLARE_INSTANCE_CHECKER(PnvHomer, PNV8_HOMER,
+ TYPE_PNV8_HOMER)
#define TYPE_PNV9_HOMER TYPE_PNV_HOMER "-POWER9"
-#define PNV9_HOMER(obj) OBJECT_CHECK(PnvHomer, (obj), TYPE_PNV9_HOMER)
+DECLARE_INSTANCE_CHECKER(PnvHomer, PNV9_HOMER,
+ TYPE_PNV9_HOMER)
struct PnvHomer {
DeviceState parent;
@@ -40,10 +43,6 @@ struct PnvHomer {
MemoryRegion regs;
};
-#define PNV_HOMER_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvHomerClass, (klass), TYPE_PNV_HOMER)
-#define PNV_HOMER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvHomerClass, (obj), TYPE_PNV_HOMER)
struct PnvHomerClass {
DeviceClass parent_class;
diff --git a/include/hw/ppc/pnv_lpc.h b/include/hw/ppc/pnv_lpc.h
index 50d92517f2..cd3c13c2a8 100644
--- a/include/hw/ppc/pnv_lpc.h
+++ b/include/hw/ppc/pnv_lpc.h
@@ -26,16 +26,19 @@
#define TYPE_PNV_LPC "pnv-lpc"
typedef struct PnvLpcClass PnvLpcClass;
typedef struct PnvLpcController PnvLpcController;
-#define PNV_LPC(obj) \
- OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV_LPC)
+DECLARE_OBJ_CHECKERS(PnvLpcController, PnvLpcClass,
+ PNV_LPC, TYPE_PNV_LPC)
#define TYPE_PNV8_LPC TYPE_PNV_LPC "-POWER8"
-#define PNV8_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV8_LPC)
+DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV8_LPC,
+ TYPE_PNV8_LPC)
#define TYPE_PNV9_LPC TYPE_PNV_LPC "-POWER9"
-#define PNV9_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV9_LPC)
+DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV9_LPC,
+ TYPE_PNV9_LPC)
#define TYPE_PNV10_LPC TYPE_PNV_LPC "-POWER10"
-#define PNV10_LPC(obj) OBJECT_CHECK(PnvLpcController, (obj), TYPE_PNV10_LPC)
+DECLARE_INSTANCE_CHECKER(PnvLpcController, PNV10_LPC,
+ TYPE_PNV10_LPC)
struct PnvLpcController {
DeviceState parent;
@@ -84,10 +87,6 @@ struct PnvLpcController {
PnvPsi *psi;
};
-#define PNV_LPC_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvLpcClass, (klass), TYPE_PNV_LPC)
-#define PNV_LPC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvLpcClass, (obj), TYPE_PNV_LPC)
struct PnvLpcClass {
DeviceClass parent_class;
diff --git a/include/hw/ppc/pnv_occ.h b/include/hw/ppc/pnv_occ.h
index 30a9faea78..4fcfb32417 100644
--- a/include/hw/ppc/pnv_occ.h
+++ b/include/hw/ppc/pnv_occ.h
@@ -26,11 +26,14 @@
#define TYPE_PNV_OCC "pnv-occ"
typedef struct PnvOCC PnvOCC;
typedef struct PnvOCCClass PnvOCCClass;
-#define PNV_OCC(obj) OBJECT_CHECK(PnvOCC, (obj), TYPE_PNV_OCC)
+DECLARE_OBJ_CHECKERS(PnvOCC, PnvOCCClass,
+ PNV_OCC, TYPE_PNV_OCC)
#define TYPE_PNV8_OCC TYPE_PNV_OCC "-POWER8"
-#define PNV8_OCC(obj) OBJECT_CHECK(PnvOCC, (obj), TYPE_PNV8_OCC)
+DECLARE_INSTANCE_CHECKER(PnvOCC, PNV8_OCC,
+ TYPE_PNV8_OCC)
#define TYPE_PNV9_OCC TYPE_PNV_OCC "-POWER9"
-#define PNV9_OCC(obj) OBJECT_CHECK(PnvOCC, (obj), TYPE_PNV9_OCC)
+DECLARE_INSTANCE_CHECKER(PnvOCC, PNV9_OCC,
+ TYPE_PNV9_OCC)
#define PNV_OCC_SENSOR_DATA_BLOCK_OFFSET 0x00580000
#define PNV_OCC_SENSOR_DATA_BLOCK_SIZE 0x00025800
@@ -47,10 +50,6 @@ struct PnvOCC {
MemoryRegion sram_regs;
};
-#define PNV_OCC_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvOCCClass, (klass), TYPE_PNV_OCC)
-#define PNV_OCC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvOCCClass, (obj), TYPE_PNV_OCC)
struct PnvOCCClass {
DeviceClass parent_class;
diff --git a/include/hw/ppc/pnv_pnor.h b/include/hw/ppc/pnv_pnor.h
index 8b27bf111c..1ec4098bb9 100644
--- a/include/hw/ppc/pnv_pnor.h
+++ b/include/hw/ppc/pnv_pnor.h
@@ -17,7 +17,8 @@
#define TYPE_PNV_PNOR "pnv-pnor"
typedef struct PnvPnor PnvPnor;
-#define PNV_PNOR(obj) OBJECT_CHECK(PnvPnor, (obj), TYPE_PNV_PNOR)
+DECLARE_INSTANCE_CHECKER(PnvPnor, PNV_PNOR,
+ TYPE_PNV_PNOR)
struct PnvPnor {
SysBusDevice parent_obj;
diff --git a/include/hw/ppc/pnv_psi.h b/include/hw/ppc/pnv_psi.h
index 060a7a110c..a33195df17 100644
--- a/include/hw/ppc/pnv_psi.h
+++ b/include/hw/ppc/pnv_psi.h
@@ -28,8 +28,8 @@
#define TYPE_PNV_PSI "pnv-psi"
typedef struct PnvPsi PnvPsi;
typedef struct PnvPsiClass PnvPsiClass;
-#define PNV_PSI(obj) \
- OBJECT_CHECK(PnvPsi, (obj), TYPE_PNV_PSI)
+DECLARE_OBJ_CHECKERS(PnvPsi, PnvPsiClass,
+ PNV_PSI, TYPE_PNV_PSI)
#define PSIHB_XSCOM_MAX 0x20
@@ -54,8 +54,8 @@ struct PnvPsi {
#define TYPE_PNV8_PSI TYPE_PNV_PSI "-POWER8"
typedef struct Pnv8Psi Pnv8Psi;
-#define PNV8_PSI(obj) \
- OBJECT_CHECK(Pnv8Psi, (obj), TYPE_PNV8_PSI)
+DECLARE_INSTANCE_CHECKER(Pnv8Psi, PNV8_PSI,
+ TYPE_PNV8_PSI)
struct Pnv8Psi {
PnvPsi parent;
@@ -65,8 +65,8 @@ struct Pnv8Psi {
#define TYPE_PNV9_PSI TYPE_PNV_PSI "-POWER9"
typedef struct Pnv9Psi Pnv9Psi;
-#define PNV9_PSI(obj) \
- OBJECT_CHECK(Pnv9Psi, (obj), TYPE_PNV9_PSI)
+DECLARE_INSTANCE_CHECKER(Pnv9Psi, PNV9_PSI,
+ TYPE_PNV9_PSI)
struct Pnv9Psi {
PnvPsi parent;
@@ -76,10 +76,6 @@ struct Pnv9Psi {
#define TYPE_PNV10_PSI TYPE_PNV_PSI "-POWER10"
-#define PNV_PSI_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvPsiClass, (klass), TYPE_PNV_PSI)
-#define PNV_PSI_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvPsiClass, (obj), TYPE_PNV_PSI)
struct PnvPsiClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/ppc/pnv_xive.h b/include/hw/ppc/pnv_xive.h
index 24c37de184..a014e2a726 100644
--- a/include/hw/ppc/pnv_xive.h
+++ b/include/hw/ppc/pnv_xive.h
@@ -18,11 +18,8 @@ struct PnvChip;
#define TYPE_PNV_XIVE "pnv-xive"
typedef struct PnvXive PnvXive;
typedef struct PnvXiveClass PnvXiveClass;
-#define PNV_XIVE(obj) OBJECT_CHECK(PnvXive, (obj), TYPE_PNV_XIVE)
-#define PNV_XIVE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvXiveClass, (klass), TYPE_PNV_XIVE)
-#define PNV_XIVE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvXiveClass, (obj), TYPE_PNV_XIVE)
+DECLARE_OBJ_CHECKERS(PnvXive, PnvXiveClass,
+ PNV_XIVE, TYPE_PNV_XIVE)
#define XIVE_BLOCK_MAX 16
diff --git a/include/hw/ppc/pnv_xscom.h b/include/hw/ppc/pnv_xscom.h
index fb9b97f5be..7e3b189c07 100644
--- a/include/hw/ppc/pnv_xscom.h
+++ b/include/hw/ppc/pnv_xscom.h
@@ -28,11 +28,8 @@ typedef struct PnvXScomInterface PnvXScomInterface;
#define PNV_XSCOM_INTERFACE(obj) \
INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
typedef struct PnvXScomInterfaceClass PnvXScomInterfaceClass;
-#define PNV_XSCOM_INTERFACE_CLASS(klass) \
- OBJECT_CLASS_CHECK(PnvXScomInterfaceClass, (klass), \
+DECLARE_CLASS_CHECKERS(PnvXScomInterfaceClass, PNV_XSCOM_INTERFACE,
TYPE_PNV_XSCOM_INTERFACE)
-#define PNV_XSCOM_INTERFACE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PnvXScomInterfaceClass, (obj), TYPE_PNV_XSCOM_INTERFACE)
struct PnvXScomInterfaceClass {
InterfaceClass parent;
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index c0be8980c7..c8cd63bc06 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -29,8 +29,8 @@ typedef struct SpaprPendingHpt SpaprPendingHpt;
#define TYPE_SPAPR_RTC "spapr-rtc"
typedef struct SpaprRtcState SpaprRtcState;
-#define SPAPR_RTC(obj) \
- OBJECT_CHECK(SpaprRtcState, (obj), TYPE_SPAPR_RTC)
+DECLARE_INSTANCE_CHECKER(SpaprRtcState, SPAPR_RTC,
+ TYPE_SPAPR_RTC)
struct SpaprRtcState {
/*< private >*/
@@ -43,12 +43,8 @@ typedef struct SpaprMachineClass SpaprMachineClass;
#define TYPE_SPAPR_MACHINE "spapr-machine"
typedef struct SpaprMachineState SpaprMachineState;
-#define SPAPR_MACHINE(obj) \
- OBJECT_CHECK(SpaprMachineState, (obj), TYPE_SPAPR_MACHINE)
-#define SPAPR_MACHINE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SpaprMachineClass, obj, TYPE_SPAPR_MACHINE)
-#define SPAPR_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SpaprMachineClass, klass, TYPE_SPAPR_MACHINE)
+DECLARE_OBJ_CHECKERS(SpaprMachineState, SpaprMachineClass,
+ SPAPR_MACHINE, TYPE_SPAPR_MACHINE)
typedef enum {
SPAPR_RESIZE_HPT_DEFAULT = 0,
@@ -791,12 +787,12 @@ static inline void spapr_dt_irq(uint32_t *intspec, int irq, bool is_lsi)
typedef struct SpaprTceTable SpaprTceTable;
#define TYPE_SPAPR_TCE_TABLE "spapr-tce-table"
-#define SPAPR_TCE_TABLE(obj) \
- OBJECT_CHECK(SpaprTceTable, (obj), TYPE_SPAPR_TCE_TABLE)
+DECLARE_INSTANCE_CHECKER(SpaprTceTable, SPAPR_TCE_TABLE,
+ TYPE_SPAPR_TCE_TABLE)
#define TYPE_SPAPR_IOMMU_MEMORY_REGION "spapr-iommu-memory-region"
-#define SPAPR_IOMMU_MEMORY_REGION(obj) \
- OBJECT_CHECK(IOMMUMemoryRegion, (obj), TYPE_SPAPR_IOMMU_MEMORY_REGION)
+DECLARE_INSTANCE_CHECKER(IOMMUMemoryRegion, SPAPR_IOMMU_MEMORY_REGION,
+ TYPE_SPAPR_IOMMU_MEMORY_REGION)
struct SpaprTceTable {
DeviceState parent;
diff --git a/include/hw/ppc/spapr_cpu_core.h b/include/hw/ppc/spapr_cpu_core.h
index adcf74dbc3..fba6a01050 100644
--- a/include/hw/ppc/spapr_cpu_core.h
+++ b/include/hw/ppc/spapr_cpu_core.h
@@ -18,12 +18,8 @@
#define TYPE_SPAPR_CPU_CORE "spapr-cpu-core"
typedef struct SpaprCpuCore SpaprCpuCore;
typedef struct SpaprCpuCoreClass SpaprCpuCoreClass;
-#define SPAPR_CPU_CORE(obj) \
- OBJECT_CHECK(SpaprCpuCore, (obj), TYPE_SPAPR_CPU_CORE)
-#define SPAPR_CPU_CORE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SpaprCpuCoreClass, (klass), TYPE_SPAPR_CPU_CORE)
-#define SPAPR_CPU_CORE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SpaprCpuCoreClass, (obj), TYPE_SPAPR_CPU_CORE)
+DECLARE_OBJ_CHECKERS(SpaprCpuCore, SpaprCpuCoreClass,
+ SPAPR_CPU_CORE, TYPE_SPAPR_CPU_CORE)
#define SPAPR_CPU_CORE_TYPE_NAME(model) model "-" TYPE_SPAPR_CPU_CORE
diff --git a/include/hw/ppc/spapr_irq.h b/include/hw/ppc/spapr_irq.h
index 83addd0a0b..c22a72c9e2 100644
--- a/include/hw/ppc/spapr_irq.h
+++ b/include/hw/ppc/spapr_irq.h
@@ -37,10 +37,8 @@ typedef struct SpaprInterruptController SpaprInterruptController;
#define SPAPR_INTC(obj) \
INTERFACE_CHECK(SpaprInterruptController, (obj), TYPE_SPAPR_INTC)
typedef struct SpaprInterruptControllerClass SpaprInterruptControllerClass;
-#define SPAPR_INTC_CLASS(klass) \
- OBJECT_CLASS_CHECK(SpaprInterruptControllerClass, (klass), TYPE_SPAPR_INTC)
-#define SPAPR_INTC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SpaprInterruptControllerClass, (obj), TYPE_SPAPR_INTC)
+DECLARE_CLASS_CHECKERS(SpaprInterruptControllerClass, SPAPR_INTC,
+ TYPE_SPAPR_INTC)
struct SpaprInterruptControllerClass {
InterfaceClass parent;
diff --git a/include/hw/ppc/spapr_tpm_proxy.h b/include/hw/ppc/spapr_tpm_proxy.h
index 1e9890d978..300c81b1f0 100644
--- a/include/hw/ppc/spapr_tpm_proxy.h
+++ b/include/hw/ppc/spapr_tpm_proxy.h
@@ -18,8 +18,8 @@
#define TYPE_SPAPR_TPM_PROXY "spapr-tpm-proxy"
typedef struct SpaprTpmProxy SpaprTpmProxy;
-#define SPAPR_TPM_PROXY(obj) OBJECT_CHECK(SpaprTpmProxy, (obj), \
- TYPE_SPAPR_TPM_PROXY)
+DECLARE_INSTANCE_CHECKER(SpaprTpmProxy, SPAPR_TPM_PROXY,
+ TYPE_SPAPR_TPM_PROXY)
struct SpaprTpmProxy {
/*< private >*/
diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h
index 9c9d14e63b..e289028634 100644
--- a/include/hw/ppc/spapr_vio.h
+++ b/include/hw/ppc/spapr_vio.h
@@ -30,16 +30,13 @@
#define TYPE_VIO_SPAPR_DEVICE "vio-spapr-device"
typedef struct SpaprVioDevice SpaprVioDevice;
typedef struct SpaprVioDeviceClass SpaprVioDeviceClass;
-#define VIO_SPAPR_DEVICE(obj) \
- OBJECT_CHECK(SpaprVioDevice, (obj), TYPE_VIO_SPAPR_DEVICE)
-#define VIO_SPAPR_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SpaprVioDeviceClass, (klass), TYPE_VIO_SPAPR_DEVICE)
-#define VIO_SPAPR_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SpaprVioDeviceClass, (obj), TYPE_VIO_SPAPR_DEVICE)
+DECLARE_OBJ_CHECKERS(SpaprVioDevice, SpaprVioDeviceClass,
+ VIO_SPAPR_DEVICE, TYPE_VIO_SPAPR_DEVICE)
#define TYPE_SPAPR_VIO_BUS "spapr-vio-bus"
typedef struct SpaprVioBus SpaprVioBus;
-#define SPAPR_VIO_BUS(obj) OBJECT_CHECK(SpaprVioBus, (obj), TYPE_SPAPR_VIO_BUS)
+DECLARE_INSTANCE_CHECKER(SpaprVioBus, SPAPR_VIO_BUS,
+ TYPE_SPAPR_VIO_BUS)
#define TYPE_SPAPR_VIO_BRIDGE "spapr-vio-bridge"
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index e5f48faba0..bcb584b90d 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -50,15 +50,13 @@ typedef struct ICSIRQState ICSIRQState;
typedef struct XICSFabric XICSFabric;
#define TYPE_ICP "icp"
-#define ICP(obj) OBJECT_CHECK(ICPState, (obj), TYPE_ICP)
+DECLARE_OBJ_CHECKERS(ICPState, ICPStateClass,
+ ICP, TYPE_ICP)
#define TYPE_PNV_ICP "pnv-icp"
-#define PNV_ICP(obj) OBJECT_CHECK(PnvICPState, (obj), TYPE_PNV_ICP)
+DECLARE_INSTANCE_CHECKER(PnvICPState, PNV_ICP,
+ TYPE_PNV_ICP)
-#define ICP_CLASS(klass) \
- OBJECT_CLASS_CHECK(ICPStateClass, (klass), TYPE_ICP)
-#define ICP_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ICPStateClass, (obj), TYPE_ICP)
struct ICPStateClass {
DeviceClass parent_class;
@@ -91,12 +89,9 @@ struct PnvICPState {
};
#define TYPE_ICS "ics"
-#define ICS(obj) OBJECT_CHECK(ICSState, (obj), TYPE_ICS)
+DECLARE_OBJ_CHECKERS(ICSState, ICSStateClass,
+ ICS, TYPE_ICS)
-#define ICS_CLASS(klass) \
- OBJECT_CLASS_CHECK(ICSStateClass, (klass), TYPE_ICS)
-#define ICS_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ICSStateClass, (obj), TYPE_ICS)
struct ICSStateClass {
DeviceClass parent_class;
@@ -147,10 +142,8 @@ struct ICSIRQState {
#define XICS_FABRIC(obj) \
INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC)
typedef struct XICSFabricClass XICSFabricClass;
-#define XICS_FABRIC_CLASS(klass) \
- OBJECT_CLASS_CHECK(XICSFabricClass, (klass), TYPE_XICS_FABRIC)
-#define XICS_FABRIC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XICSFabricClass, (obj), TYPE_XICS_FABRIC)
+DECLARE_CLASS_CHECKERS(XICSFabricClass, XICS_FABRIC,
+ TYPE_XICS_FABRIC)
struct XICSFabricClass {
InterfaceClass parent;
diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
index 8ef9af1969..48595ab641 100644
--- a/include/hw/ppc/xive.h
+++ b/include/hw/ppc/xive.h
@@ -155,10 +155,8 @@ typedef struct XiveNotifier XiveNotifier;
#define XIVE_NOTIFIER(obj) \
INTERFACE_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER)
typedef struct XiveNotifierClass XiveNotifierClass;
-#define XIVE_NOTIFIER_CLASS(klass) \
- OBJECT_CLASS_CHECK(XiveNotifierClass, (klass), TYPE_XIVE_NOTIFIER)
-#define XIVE_NOTIFIER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XiveNotifierClass, (obj), TYPE_XIVE_NOTIFIER)
+DECLARE_CLASS_CHECKERS(XiveNotifierClass, XIVE_NOTIFIER,
+ TYPE_XIVE_NOTIFIER)
struct XiveNotifierClass {
InterfaceClass parent;
@@ -171,7 +169,8 @@ struct XiveNotifierClass {
#define TYPE_XIVE_SOURCE "xive-source"
typedef struct XiveSource XiveSource;
-#define XIVE_SOURCE(obj) OBJECT_CHECK(XiveSource, (obj), TYPE_XIVE_SOURCE)
+DECLARE_INSTANCE_CHECKER(XiveSource, XIVE_SOURCE,
+ TYPE_XIVE_SOURCE)
/*
* XIVE Interrupt Source characteristics, which define how the ESB are
@@ -308,7 +307,8 @@ void xive_source_set_irq(void *opaque, int srcno, int val);
#define TYPE_XIVE_TCTX "xive-tctx"
typedef struct XiveTCTX XiveTCTX;
-#define XIVE_TCTX(obj) OBJECT_CHECK(XiveTCTX, (obj), TYPE_XIVE_TCTX)
+DECLARE_INSTANCE_CHECKER(XiveTCTX, XIVE_TCTX,
+ TYPE_XIVE_TCTX)
/*
* XIVE Thread interrupt Management register rings :
@@ -349,12 +349,8 @@ typedef struct XiveRouter XiveRouter;
#define TYPE_XIVE_ROUTER "xive-router"
typedef struct XiveRouterClass XiveRouterClass;
-#define XIVE_ROUTER(obj) \
- OBJECT_CHECK(XiveRouter, (obj), TYPE_XIVE_ROUTER)
-#define XIVE_ROUTER_CLASS(klass) \
- OBJECT_CLASS_CHECK(XiveRouterClass, (klass), TYPE_XIVE_ROUTER)
-#define XIVE_ROUTER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XiveRouterClass, (obj), TYPE_XIVE_ROUTER)
+DECLARE_OBJ_CHECKERS(XiveRouter, XiveRouterClass,
+ XIVE_ROUTER, TYPE_XIVE_ROUTER)
struct XiveRouterClass {
SysBusDeviceClass parent;
@@ -398,10 +394,8 @@ typedef struct XiveTCTXMatch {
#define XIVE_PRESENTER(obj) \
INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER)
typedef struct XivePresenterClass XivePresenterClass;
-#define XIVE_PRESENTER_CLASS(klass) \
- OBJECT_CLASS_CHECK(XivePresenterClass, (klass), TYPE_XIVE_PRESENTER)
-#define XIVE_PRESENTER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XivePresenterClass, (obj), TYPE_XIVE_PRESENTER)
+DECLARE_CLASS_CHECKERS(XivePresenterClass, XIVE_PRESENTER,
+ TYPE_XIVE_PRESENTER)
struct XivePresenterClass {
InterfaceClass parent;
@@ -425,10 +419,8 @@ int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx,
#define XIVE_FABRIC(obj) \
INTERFACE_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC)
typedef struct XiveFabricClass XiveFabricClass;
-#define XIVE_FABRIC_CLASS(klass) \
- OBJECT_CLASS_CHECK(XiveFabricClass, (klass), TYPE_XIVE_FABRIC)
-#define XIVE_FABRIC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XiveFabricClass, (obj), TYPE_XIVE_FABRIC)
+DECLARE_CLASS_CHECKERS(XiveFabricClass, XIVE_FABRIC,
+ TYPE_XIVE_FABRIC)
struct XiveFabricClass {
InterfaceClass parent;
@@ -444,8 +436,8 @@ struct XiveFabricClass {
#define TYPE_XIVE_END_SOURCE "xive-end-source"
typedef struct XiveENDSource XiveENDSource;
-#define XIVE_END_SOURCE(obj) \
- OBJECT_CHECK(XiveENDSource, (obj), TYPE_XIVE_END_SOURCE)
+DECLARE_INSTANCE_CHECKER(XiveENDSource, XIVE_END_SOURCE,
+ TYPE_XIVE_END_SOURCE)
struct XiveENDSource {
DeviceState parent;
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 479377f37b..e025ba9653 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -13,9 +13,8 @@ enum {
#define TYPE_DEVICE "device"
typedef struct DeviceClass DeviceClass;
-#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE)
-#define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE)
-#define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE)
+DECLARE_OBJ_CHECKERS(DeviceState, DeviceClass,
+ DEVICE, TYPE_DEVICE)
typedef enum DeviceCategory {
DEVICE_CATEGORY_BRIDGE,
@@ -204,9 +203,8 @@ struct DeviceListener {
};
#define TYPE_BUS "bus"
-#define BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_BUS)
-#define BUS_CLASS(klass) OBJECT_CLASS_CHECK(BusClass, (klass), TYPE_BUS)
-#define BUS_GET_CLASS(obj) OBJECT_GET_CLASS(BusClass, (obj), TYPE_BUS)
+DECLARE_OBJ_CHECKERS(BusState, BusClass,
+ BUS, TYPE_BUS)
struct BusClass {
ObjectClass parent_class;
diff --git a/include/hw/rdma/rdma.h b/include/hw/rdma/rdma.h
index aef82e58db..e77e43a170 100644
--- a/include/hw/rdma/rdma.h
+++ b/include/hw/rdma/rdma.h
@@ -20,12 +20,8 @@
#define INTERFACE_RDMA_PROVIDER "rdma"
typedef struct RdmaProviderClass RdmaProviderClass;
-#define RDMA_PROVIDER_CLASS(klass) \
- OBJECT_CLASS_CHECK(RdmaProviderClass, (klass), \
+DECLARE_CLASS_CHECKERS(RdmaProviderClass, RDMA_PROVIDER,
INTERFACE_RDMA_PROVIDER)
-#define RDMA_PROVIDER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(RdmaProviderClass, (obj), \
- INTERFACE_RDMA_PROVIDER)
#define RDMA_PROVIDER(obj) \
INTERFACE_CHECK(RdmaProvider, (obj), \
INTERFACE_RDMA_PROVIDER)
diff --git a/include/hw/register.h b/include/hw/register.h
index 29c669e901..03c8926d27 100644
--- a/include/hw/register.h
+++ b/include/hw/register.h
@@ -88,7 +88,8 @@ struct RegisterInfo {
};
#define TYPE_REGISTER "qemu,register"
-#define REGISTER(obj) OBJECT_CHECK(RegisterInfo, (obj), TYPE_REGISTER)
+DECLARE_INSTANCE_CHECKER(RegisterInfo, REGISTER,
+ TYPE_REGISTER)
/**
* This structure is used to group all of the individual registers which are
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
index bcd36bce06..bdcd1276b6 100644
--- a/include/hw/resettable.h
+++ b/include/hw/resettable.h
@@ -18,11 +18,9 @@
#define TYPE_RESETTABLE_INTERFACE "resettable"
typedef struct ResettableClass ResettableClass;
-#define RESETTABLE_CLASS(class) \
- OBJECT_CLASS_CHECK(ResettableClass, (class), TYPE_RESETTABLE_INTERFACE)
+DECLARE_CLASS_CHECKERS(ResettableClass, RESETTABLE,
+ TYPE_RESETTABLE_INTERFACE)
-#define RESETTABLE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(ResettableClass, (obj), TYPE_RESETTABLE_INTERFACE)
typedef struct ResettableState ResettableState;
diff --git a/include/hw/riscv/opentitan.h b/include/hw/riscv/opentitan.h
index b42599ff54..8c15b6325f 100644
--- a/include/hw/riscv/opentitan.h
+++ b/include/hw/riscv/opentitan.h
@@ -26,8 +26,8 @@
#define TYPE_RISCV_IBEX_SOC "riscv.lowrisc.ibex.soc"
typedef struct LowRISCIbexSoCState LowRISCIbexSoCState;
-#define RISCV_IBEX_SOC(obj) \
- OBJECT_CHECK(LowRISCIbexSoCState, (obj), TYPE_RISCV_IBEX_SOC)
+DECLARE_INSTANCE_CHECKER(LowRISCIbexSoCState, RISCV_IBEX_SOC,
+ TYPE_RISCV_IBEX_SOC)
struct LowRISCIbexSoCState {
/*< private >*/
diff --git a/include/hw/riscv/riscv_hart.h b/include/hw/riscv/riscv_hart.h
index 617b977214..9be1fd80ed 100644
--- a/include/hw/riscv/riscv_hart.h
+++ b/include/hw/riscv/riscv_hart.h
@@ -28,8 +28,8 @@
#define TYPE_RISCV_HART_ARRAY "riscv.hart_array"
typedef struct RISCVHartArrayState RISCVHartArrayState;
-#define RISCV_HART_ARRAY(obj) \
- OBJECT_CHECK(RISCVHartArrayState, (obj), TYPE_RISCV_HART_ARRAY)
+DECLARE_INSTANCE_CHECKER(RISCVHartArrayState, RISCV_HART_ARRAY,
+ TYPE_RISCV_HART_ARRAY)
struct RISCVHartArrayState {
/*< private >*/
diff --git a/include/hw/riscv/spike.h b/include/hw/riscv/spike.h
index 121396d07a..cddeca2e77 100644
--- a/include/hw/riscv/spike.h
+++ b/include/hw/riscv/spike.h
@@ -28,8 +28,8 @@
#define TYPE_SPIKE_MACHINE MACHINE_TYPE_NAME("spike")
typedef struct SpikeState SpikeState;
-#define SPIKE_MACHINE(obj) \
- OBJECT_CHECK(SpikeState, (obj), TYPE_SPIKE_MACHINE)
+DECLARE_INSTANCE_CHECKER(SpikeState, SPIKE_MACHINE,
+ TYPE_SPIKE_MACHINE)
struct SpikeState {
/*< private >*/
diff --git a/include/hw/riscv/virt.h b/include/hw/riscv/virt.h
index 3069379c84..b4ed9a32eb 100644
--- a/include/hw/riscv/virt.h
+++ b/include/hw/riscv/virt.h
@@ -29,8 +29,8 @@
#define TYPE_RISCV_VIRT_MACHINE MACHINE_TYPE_NAME("virt")
typedef struct RISCVVirtState RISCVVirtState;
-#define RISCV_VIRT_MACHINE(obj) \
- OBJECT_CHECK(RISCVVirtState, (obj), TYPE_RISCV_VIRT_MACHINE)
+DECLARE_INSTANCE_CHECKER(RISCVVirtState, RISCV_VIRT_MACHINE,
+ TYPE_RISCV_VIRT_MACHINE)
struct RISCVVirtState {
/*< private >*/
diff --git a/include/hw/rtc/allwinner-rtc.h b/include/hw/rtc/allwinner-rtc.h
index 1126e05f23..5a6e9fff32 100644
--- a/include/hw/rtc/allwinner-rtc.h
+++ b/include/hw/rtc/allwinner-rtc.h
@@ -62,12 +62,8 @@
typedef struct AwRtcClass AwRtcClass;
typedef struct AwRtcState AwRtcState;
-#define AW_RTC(obj) \
- OBJECT_CHECK(AwRtcState, (obj), TYPE_AW_RTC)
-#define AW_RTC_CLASS(klass) \
- OBJECT_CLASS_CHECK(AwRtcClass, (klass), TYPE_AW_RTC)
-#define AW_RTC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AwRtcClass, (obj), TYPE_AW_RTC)
+DECLARE_OBJ_CHECKERS(AwRtcState, AwRtcClass,
+ AW_RTC, TYPE_AW_RTC)
/** @} */
diff --git a/include/hw/rtc/aspeed_rtc.h b/include/hw/rtc/aspeed_rtc.h
index 295f4a7d30..d7691ab88f 100644
--- a/include/hw/rtc/aspeed_rtc.h
+++ b/include/hw/rtc/aspeed_rtc.h
@@ -24,6 +24,7 @@ struct AspeedRtcState {
typedef struct AspeedRtcState AspeedRtcState;
#define TYPE_ASPEED_RTC "aspeed.rtc"
-#define ASPEED_RTC(obj) OBJECT_CHECK(AspeedRtcState, (obj), TYPE_ASPEED_RTC)
+DECLARE_INSTANCE_CHECKER(AspeedRtcState, ASPEED_RTC,
+ TYPE_ASPEED_RTC)
#endif /* HW_RTC_ASPEED_RTC_H */
diff --git a/include/hw/rtc/goldfish_rtc.h b/include/hw/rtc/goldfish_rtc.h
index f31b0cbb89..b710c21c94 100644
--- a/include/hw/rtc/goldfish_rtc.h
+++ b/include/hw/rtc/goldfish_rtc.h
@@ -27,8 +27,8 @@
#define TYPE_GOLDFISH_RTC "goldfish_rtc"
typedef struct GoldfishRTCState GoldfishRTCState;
-#define GOLDFISH_RTC(obj) \
- OBJECT_CHECK(GoldfishRTCState, (obj), TYPE_GOLDFISH_RTC)
+DECLARE_INSTANCE_CHECKER(GoldfishRTCState, GOLDFISH_RTC,
+ TYPE_GOLDFISH_RTC)
struct GoldfishRTCState {
SysBusDevice parent_obj;
diff --git a/include/hw/rtc/m48t59.h b/include/hw/rtc/m48t59.h
index 78aae2c072..04abedf3b2 100644
--- a/include/hw/rtc/m48t59.h
+++ b/include/hw/rtc/m48t59.h
@@ -32,10 +32,8 @@
#define TYPE_NVRAM "nvram"
typedef struct NvramClass NvramClass;
-#define NVRAM_CLASS(klass) \
- OBJECT_CLASS_CHECK(NvramClass, (klass), TYPE_NVRAM)
-#define NVRAM_GET_CLASS(obj) \
- OBJECT_GET_CLASS(NvramClass, (obj), TYPE_NVRAM)
+DECLARE_CLASS_CHECKERS(NvramClass, NVRAM,
+ TYPE_NVRAM)
#define NVRAM(obj) \
INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM)
diff --git a/include/hw/rtc/mc146818rtc.h b/include/hw/rtc/mc146818rtc.h
index 7b42d9c534..e58e006d0d 100644
--- a/include/hw/rtc/mc146818rtc.h
+++ b/include/hw/rtc/mc146818rtc.h
@@ -17,7 +17,8 @@
#define TYPE_MC146818_RTC "mc146818rtc"
typedef struct RTCState RTCState;
-#define MC146818_RTC(obj) OBJECT_CHECK(RTCState, (obj), TYPE_MC146818_RTC)
+DECLARE_INSTANCE_CHECKER(RTCState, MC146818_RTC,
+ TYPE_MC146818_RTC)
struct RTCState {
ISADevice parent_obj;
diff --git a/include/hw/rtc/pl031.h b/include/hw/rtc/pl031.h
index 3ddf48cc76..3897b424d4 100644
--- a/include/hw/rtc/pl031.h
+++ b/include/hw/rtc/pl031.h
@@ -20,7 +20,8 @@
#define TYPE_PL031 "pl031"
typedef struct PL031State PL031State;
-#define PL031(obj) OBJECT_CHECK(PL031State, (obj), TYPE_PL031)
+DECLARE_INSTANCE_CHECKER(PL031State, PL031,
+ TYPE_PL031)
struct PL031State {
SysBusDevice parent_obj;
diff --git a/include/hw/rtc/xlnx-zynqmp-rtc.h b/include/hw/rtc/xlnx-zynqmp-rtc.h
index 95c85d3bf1..209de85ae6 100644
--- a/include/hw/rtc/xlnx-zynqmp-rtc.h
+++ b/include/hw/rtc/xlnx-zynqmp-rtc.h
@@ -34,8 +34,8 @@
#define TYPE_XLNX_ZYNQMP_RTC "xlnx-zynmp.rtc"
typedef struct XlnxZynqMPRTC XlnxZynqMPRTC;
-#define XLNX_ZYNQMP_RTC(obj) \
- OBJECT_CHECK(XlnxZynqMPRTC, (obj), TYPE_XLNX_ZYNQMP_RTC)
+DECLARE_INSTANCE_CHECKER(XlnxZynqMPRTC, XLNX_ZYNQMP_RTC,
+ TYPE_XLNX_ZYNQMP_RTC)
REG32(SET_TIME_WRITE, 0x0)
REG32(SET_TIME_READ, 0x4)
diff --git a/include/hw/rx/rx62n.h b/include/hw/rx/rx62n.h
index 4451a9e006..3ed80dba0d 100644
--- a/include/hw/rx/rx62n.h
+++ b/include/hw/rx/rx62n.h
@@ -34,7 +34,8 @@
#define TYPE_RX62N_MCU "rx62n-mcu"
typedef struct RX62NState RX62NState;
-#define RX62N_MCU(obj) OBJECT_CHECK(RX62NState, (obj), TYPE_RX62N_MCU)
+DECLARE_INSTANCE_CHECKER(RX62NState, RX62N_MCU,
+ TYPE_RX62N_MCU)
#define TYPE_R5F562N7_MCU "r5f562n7-mcu"
#define TYPE_R5F562N8_MCU "r5f562n8-mcu"
diff --git a/include/hw/s390x/3270-ccw.h b/include/hw/s390x/3270-ccw.h
index ac254f95ed..9a11093192 100644
--- a/include/hw/s390x/3270-ccw.h
+++ b/include/hw/s390x/3270-ccw.h
@@ -33,12 +33,8 @@
typedef struct EmulatedCcw3270Class EmulatedCcw3270Class;
typedef struct EmulatedCcw3270Device EmulatedCcw3270Device;
-#define EMULATED_CCW_3270(obj) \
- OBJECT_CHECK(EmulatedCcw3270Device, (obj), TYPE_EMULATED_CCW_3270)
-#define EMULATED_CCW_3270_CLASS(klass) \
- OBJECT_CLASS_CHECK(EmulatedCcw3270Class, (klass), TYPE_EMULATED_CCW_3270)
-#define EMULATED_CCW_3270_GET_CLASS(obj) \
- OBJECT_GET_CLASS(EmulatedCcw3270Class, (obj), TYPE_EMULATED_CCW_3270)
+DECLARE_OBJ_CHECKERS(EmulatedCcw3270Device, EmulatedCcw3270Class,
+ EMULATED_CCW_3270, TYPE_EMULATED_CCW_3270)
struct EmulatedCcw3270Device {
CcwDevice parent_obj;
diff --git a/include/hw/s390x/ap-device.h b/include/hw/s390x/ap-device.h
index b3b3e98a67..fb250a20f3 100644
--- a/include/hw/s390x/ap-device.h
+++ b/include/hw/s390x/ap-device.h
@@ -21,7 +21,7 @@ struct APDevice {
};
typedef struct APDevice APDevice;
-#define AP_DEVICE(obj) \
- OBJECT_CHECK(APDevice, (obj), AP_DEVICE_TYPE)
+DECLARE_INSTANCE_CHECKER(APDevice, AP_DEVICE,
+ AP_DEVICE_TYPE)
#endif /* HW_S390X_AP_DEVICE_H */
diff --git a/include/hw/s390x/css-bridge.h b/include/hw/s390x/css-bridge.h
index 05786b38de..9fd4484204 100644
--- a/include/hw/s390x/css-bridge.h
+++ b/include/hw/s390x/css-bridge.h
@@ -24,8 +24,8 @@ struct VirtualCssBridge {
typedef struct VirtualCssBridge VirtualCssBridge;
#define TYPE_VIRTUAL_CSS_BRIDGE "virtual-css-bridge"
-#define VIRTUAL_CSS_BRIDGE(obj) \
- OBJECT_CHECK(VirtualCssBridge, (obj), TYPE_VIRTUAL_CSS_BRIDGE)
+DECLARE_INSTANCE_CHECKER(VirtualCssBridge, VIRTUAL_CSS_BRIDGE,
+ TYPE_VIRTUAL_CSS_BRIDGE)
/* virtual css bus type */
struct VirtualCssBus {
@@ -34,8 +34,8 @@ struct VirtualCssBus {
typedef struct VirtualCssBus VirtualCssBus;
#define TYPE_VIRTUAL_CSS_BUS "virtual-css-bus"
-#define VIRTUAL_CSS_BUS(obj) \
- OBJECT_CHECK(VirtualCssBus, (obj), TYPE_VIRTUAL_CSS_BUS)
+DECLARE_INSTANCE_CHECKER(VirtualCssBus, VIRTUAL_CSS_BUS,
+ TYPE_VIRTUAL_CSS_BUS)
VirtualCssBus *virtual_css_bus_init(void);
#endif
diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h
index dd1a6a44c0..eccf6e924b 100644
--- a/include/hw/s390x/event-facility.h
+++ b/include/hw/s390x/event-facility.h
@@ -44,12 +44,8 @@
#define TYPE_SCLP_EVENT "s390-sclp-event-type"
typedef struct SCLPEvent SCLPEvent;
typedef struct SCLPEventClass SCLPEventClass;
-#define SCLP_EVENT(obj) \
- OBJECT_CHECK(SCLPEvent, (obj), TYPE_SCLP_EVENT)
-#define SCLP_EVENT_CLASS(klass) \
- OBJECT_CLASS_CHECK(SCLPEventClass, (klass), TYPE_SCLP_EVENT)
-#define SCLP_EVENT_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SCLPEventClass, (obj), TYPE_SCLP_EVENT)
+DECLARE_OBJ_CHECKERS(SCLPEvent, SCLPEventClass,
+ SCLP_EVENT, TYPE_SCLP_EVENT)
#define TYPE_SCLP_CPU_HOTPLUG "sclp-cpu-hotplug"
#define TYPE_SCLP_QUIESCE "sclpquiesce"
@@ -200,14 +196,8 @@ struct SCLPEventClass {
#define TYPE_SCLP_EVENT_FACILITY "s390-sclp-event-facility"
typedef struct SCLPEventFacility SCLPEventFacility;
typedef struct SCLPEventFacilityClass SCLPEventFacilityClass;
-#define EVENT_FACILITY(obj) \
- OBJECT_CHECK(SCLPEventFacility, (obj), TYPE_SCLP_EVENT_FACILITY)
-#define EVENT_FACILITY_CLASS(klass) \
- OBJECT_CLASS_CHECK(SCLPEventFacilityClass, (klass), \
- TYPE_SCLP_EVENT_FACILITY)
-#define EVENT_FACILITY_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SCLPEventFacilityClass, (obj), \
- TYPE_SCLP_EVENT_FACILITY)
+DECLARE_OBJ_CHECKERS(SCLPEventFacility, SCLPEventFacilityClass,
+ EVENT_FACILITY, TYPE_SCLP_EVENT_FACILITY)
struct SCLPEventFacilityClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/s390x/s390-ccw.h b/include/hw/s390x/s390-ccw.h
index f0f96952f1..2c807ee3a1 100644
--- a/include/hw/s390x/s390-ccw.h
+++ b/include/hw/s390x/s390-ccw.h
@@ -19,12 +19,8 @@
#define TYPE_S390_CCW "s390-ccw"
typedef struct S390CCWDevice S390CCWDevice;
typedef struct S390CCWDeviceClass S390CCWDeviceClass;
-#define S390_CCW_DEVICE(obj) \
- OBJECT_CHECK(S390CCWDevice, (obj), TYPE_S390_CCW)
-#define S390_CCW_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(S390CCWDeviceClass, (klass), TYPE_S390_CCW)
-#define S390_CCW_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(S390CCWDeviceClass, (obj), TYPE_S390_CCW)
+DECLARE_OBJ_CHECKERS(S390CCWDevice, S390CCWDeviceClass,
+ S390_CCW_DEVICE, TYPE_S390_CCW)
struct S390CCWDevice {
CcwDevice parent_obj;
diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h
index f20c503b19..54d14da0a6 100644
--- a/include/hw/s390x/s390-virtio-ccw.h
+++ b/include/hw/s390x/s390-virtio-ccw.h
@@ -18,11 +18,9 @@
typedef struct S390CcwMachineClass S390CcwMachineClass;
typedef struct S390CcwMachineState S390CcwMachineState;
-#define S390_CCW_MACHINE(obj) \
- OBJECT_CHECK(S390CcwMachineState, (obj), TYPE_S390_CCW_MACHINE)
+DECLARE_OBJ_CHECKERS(S390CcwMachineState, S390CcwMachineClass,
+ S390_CCW_MACHINE, TYPE_S390_CCW_MACHINE)
-#define S390_CCW_MACHINE_CLASS(klass) \
- OBJECT_CLASS_CHECK(S390CcwMachineClass, (klass), TYPE_S390_CCW_MACHINE)
struct S390CcwMachineState {
/*< private >*/
diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h
index 2ae7cca85b..a6a123598d 100644
--- a/include/hw/s390x/s390_flic.h
+++ b/include/hw/s390x/s390_flic.h
@@ -41,8 +41,8 @@ extern const VMStateDescription vmstate_adapter_routes;
#define TYPE_S390_FLIC_COMMON "s390-flic"
typedef struct S390FLICState S390FLICState;
typedef struct S390FLICStateClass S390FLICStateClass;
-#define S390_FLIC_COMMON(obj) \
- OBJECT_CHECK(S390FLICState, (obj), TYPE_S390_FLIC_COMMON)
+DECLARE_OBJ_CHECKERS(S390FLICState, S390FLICStateClass,
+ S390_FLIC_COMMON, TYPE_S390_FLIC_COMMON)
struct S390FLICState {
SysBusDevice parent_obj;
@@ -51,10 +51,6 @@ struct S390FLICState {
bool ais_supported;
};
-#define S390_FLIC_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(S390FLICStateClass, (klass), TYPE_S390_FLIC_COMMON)
-#define S390_FLIC_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(S390FLICStateClass, (obj), TYPE_S390_FLIC_COMMON)
struct S390FLICStateClass {
DeviceClass parent_class;
@@ -79,13 +75,13 @@ struct S390FLICStateClass {
#define TYPE_KVM_S390_FLIC "s390-flic-kvm"
typedef struct KVMS390FLICState KVMS390FLICState;
-#define KVM_S390_FLIC(obj) \
- OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC)
+DECLARE_INSTANCE_CHECKER(KVMS390FLICState, KVM_S390_FLIC,
+ TYPE_KVM_S390_FLIC)
#define TYPE_QEMU_S390_FLIC "s390-flic-qemu"
typedef struct QEMUS390FLICState QEMUS390FLICState;
-#define QEMU_S390_FLIC(obj) \
- OBJECT_CHECK(QEMUS390FLICState, (obj), TYPE_QEMU_S390_FLIC)
+DECLARE_INSTANCE_CHECKER(QEMUS390FLICState, QEMU_S390_FLIC,
+ TYPE_QEMU_S390_FLIC)
#define SIC_IRQ_MODE_ALL 0
#define SIC_IRQ_MODE_SINGLE 1
diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
index 2a5bdc6dfe..5038a45612 100644
--- a/include/hw/s390x/sclp.h
+++ b/include/hw/s390x/sclp.h
@@ -184,9 +184,8 @@ typedef struct SCCB {
#define TYPE_SCLP "sclp"
typedef struct SCLPDevice SCLPDevice;
typedef struct SCLPDeviceClass SCLPDeviceClass;
-#define SCLP(obj) OBJECT_CHECK(SCLPDevice, (obj), TYPE_SCLP)
-#define SCLP_CLASS(oc) OBJECT_CLASS_CHECK(SCLPDeviceClass, (oc), TYPE_SCLP)
-#define SCLP_GET_CLASS(obj) OBJECT_GET_CLASS(SCLPDeviceClass, (obj), TYPE_SCLP)
+DECLARE_OBJ_CHECKERS(SCLPDevice, SCLPDeviceClass,
+ SCLP, TYPE_SCLP)
struct SCLPEventFacility;
diff --git a/include/hw/s390x/storage-attributes.h b/include/hw/s390x/storage-attributes.h
index b5d9663f7c..efb28c48be 100644
--- a/include/hw/s390x/storage-attributes.h
+++ b/include/hw/s390x/storage-attributes.h
@@ -22,8 +22,8 @@
typedef struct S390StAttribClass S390StAttribClass;
typedef struct S390StAttribState S390StAttribState;
-#define S390_STATTRIB(obj) \
- OBJECT_CHECK(S390StAttribState, (obj), TYPE_S390_STATTRIB)
+DECLARE_OBJ_CHECKERS(S390StAttribState, S390StAttribClass,
+ S390_STATTRIB, TYPE_S390_STATTRIB)
struct S390StAttribState {
DeviceState parent_obj;
@@ -31,10 +31,6 @@ struct S390StAttribState {
bool migration_enabled;
};
-#define S390_STATTRIB_CLASS(klass) \
- OBJECT_CLASS_CHECK(S390StAttribClass, (klass), TYPE_S390_STATTRIB)
-#define S390_STATTRIB_GET_CLASS(obj) \
- OBJECT_GET_CLASS(S390StAttribClass, (obj), TYPE_S390_STATTRIB)
struct S390StAttribClass {
DeviceClass parent_class;
@@ -52,16 +48,16 @@ struct S390StAttribClass {
};
typedef struct QEMUS390StAttribState QEMUS390StAttribState;
-#define QEMU_S390_STATTRIB(obj) \
- OBJECT_CHECK(QEMUS390StAttribState, (obj), TYPE_QEMU_S390_STATTRIB)
+DECLARE_INSTANCE_CHECKER(QEMUS390StAttribState, QEMU_S390_STATTRIB,
+ TYPE_QEMU_S390_STATTRIB)
struct QEMUS390StAttribState {
S390StAttribState parent_obj;
};
typedef struct KVMS390StAttribState KVMS390StAttribState;
-#define KVM_S390_STATTRIB(obj) \
- OBJECT_CHECK(KVMS390StAttribState, (obj), TYPE_KVM_S390_STATTRIB)
+DECLARE_INSTANCE_CHECKER(KVMS390StAttribState, KVM_S390_STATTRIB,
+ TYPE_KVM_S390_STATTRIB)
struct KVMS390StAttribState {
S390StAttribState parent_obj;
diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h
index e94a201f71..40f042f54e 100644
--- a/include/hw/s390x/storage-keys.h
+++ b/include/hw/s390x/storage-keys.h
@@ -19,8 +19,8 @@
#define TYPE_S390_SKEYS "s390-skeys"
typedef struct S390SKeysClass S390SKeysClass;
typedef struct S390SKeysState S390SKeysState;
-#define S390_SKEYS(obj) \
- OBJECT_CHECK(S390SKeysState, (obj), TYPE_S390_SKEYS)
+DECLARE_OBJ_CHECKERS(S390SKeysState, S390SKeysClass,
+ S390_SKEYS, TYPE_S390_SKEYS)
struct S390SKeysState {
DeviceState parent_obj;
@@ -28,10 +28,6 @@ struct S390SKeysState {
};
-#define S390_SKEYS_CLASS(klass) \
- OBJECT_CLASS_CHECK(S390SKeysClass, (klass), TYPE_S390_SKEYS)
-#define S390_SKEYS_GET_CLASS(obj) \
- OBJECT_GET_CLASS(S390SKeysClass, (obj), TYPE_S390_SKEYS)
struct S390SKeysClass {
DeviceClass parent_class;
@@ -45,8 +41,8 @@ struct S390SKeysClass {
#define TYPE_KVM_S390_SKEYS "s390-skeys-kvm"
#define TYPE_QEMU_S390_SKEYS "s390-skeys-qemu"
typedef struct QEMUS390SKeysState QEMUS390SKeysState;
-#define QEMU_S390_SKEYS(obj) \
- OBJECT_CHECK(QEMUS390SKeysState, (obj), TYPE_QEMU_S390_SKEYS)
+DECLARE_INSTANCE_CHECKER(QEMUS390SKeysState, QEMU_S390_SKEYS,
+ TYPE_QEMU_S390_SKEYS)
struct QEMUS390SKeysState {
S390SKeysState parent_obj;
diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
index e240faf11c..c02498f65e 100644
--- a/include/hw/s390x/tod.h
+++ b/include/hw/s390x/tod.h
@@ -23,11 +23,8 @@ typedef struct S390TOD {
#define TYPE_S390_TOD "s390-tod"
typedef struct S390TODClass S390TODClass;
typedef struct S390TODState S390TODState;
-#define S390_TOD(obj) OBJECT_CHECK(S390TODState, (obj), TYPE_S390_TOD)
-#define S390_TOD_CLASS(oc) OBJECT_CLASS_CHECK(S390TODClass, (oc), \
- TYPE_S390_TOD)
-#define S390_TOD_GET_CLASS(obj) OBJECT_GET_CLASS(S390TODClass, (obj), \
- TYPE_S390_TOD)
+DECLARE_OBJ_CHECKERS(S390TODState, S390TODClass,
+ S390_TOD, TYPE_S390_TOD)
#define TYPE_KVM_S390_TOD TYPE_S390_TOD "-kvm"
#define TYPE_QEMU_S390_TOD TYPE_S390_TOD "-qemu"
diff --git a/include/hw/s390x/vfio-ccw.h b/include/hw/s390x/vfio-ccw.h
index 7bd4640ac3..9c9c8944ad 100644
--- a/include/hw/s390x/vfio-ccw.h
+++ b/include/hw/s390x/vfio-ccw.h
@@ -21,8 +21,8 @@
#define TYPE_VFIO_CCW "vfio-ccw"
typedef struct VFIOCCWDevice VFIOCCWDevice;
-#define VFIO_CCW(obj) \
- OBJECT_CHECK(VFIOCCWDevice, (obj), TYPE_VFIO_CCW)
+DECLARE_INSTANCE_CHECKER(VFIOCCWDevice, VFIO_CCW,
+ TYPE_VFIO_CCW)
#define TYPE_VFIO_CCW "vfio-ccw"
diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h
index d4a4e2930c..f281625dd5 100644
--- a/include/hw/scsi/esp.h
+++ b/include/hw/scsi/esp.h
@@ -67,7 +67,8 @@ struct ESPState {
#define TYPE_ESP "esp"
typedef struct SysBusESPState SysBusESPState;
-#define ESP_STATE(obj) OBJECT_CHECK(SysBusESPState, (obj), TYPE_ESP)
+DECLARE_INSTANCE_CHECKER(SysBusESPState, ESP_STATE,
+ TYPE_ESP)
struct SysBusESPState {
/*< private >*/
diff --git a/include/hw/scsi/scsi.h b/include/hw/scsi/scsi.h
index bad4dfb223..3818e3fa46 100644
--- a/include/hw/scsi/scsi.h
+++ b/include/hw/scsi/scsi.h
@@ -51,12 +51,8 @@ struct SCSIRequest {
#define TYPE_SCSI_DEVICE "scsi-device"
typedef struct SCSIDeviceClass SCSIDeviceClass;
-#define SCSI_DEVICE(obj) \
- OBJECT_CHECK(SCSIDevice, (obj), TYPE_SCSI_DEVICE)
-#define SCSI_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SCSIDeviceClass, (klass), TYPE_SCSI_DEVICE)
-#define SCSI_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SCSIDeviceClass, (obj), TYPE_SCSI_DEVICE)
+DECLARE_OBJ_CHECKERS(SCSIDevice, SCSIDeviceClass,
+ SCSI_DEVICE, TYPE_SCSI_DEVICE)
struct SCSIDeviceClass {
DeviceClass parent_class;
@@ -138,7 +134,8 @@ struct SCSIBusInfo {
};
#define TYPE_SCSI_BUS "SCSI"
-#define SCSI_BUS(obj) OBJECT_CHECK(SCSIBus, (obj), TYPE_SCSI_BUS)
+DECLARE_INSTANCE_CHECKER(SCSIBus, SCSI_BUS,
+ TYPE_SCSI_BUS)
struct SCSIBus {
BusState qbus;
diff --git a/include/hw/sd/allwinner-sdhost.h b/include/hw/sd/allwinner-sdhost.h
index b23de2c548..7bccc06d1c 100644
--- a/include/hw/sd/allwinner-sdhost.h
+++ b/include/hw/sd/allwinner-sdhost.h
@@ -47,12 +47,8 @@
typedef struct AwSdHostClass AwSdHostClass;
typedef struct AwSdHostState AwSdHostState;
-#define AW_SDHOST(obj) \
- OBJECT_CHECK(AwSdHostState, (obj), TYPE_AW_SDHOST)
-#define AW_SDHOST_CLASS(klass) \
- OBJECT_CLASS_CHECK(AwSdHostClass, (klass), TYPE_AW_SDHOST)
-#define AW_SDHOST_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AwSdHostClass, (obj), TYPE_AW_SDHOST)
+DECLARE_OBJ_CHECKERS(AwSdHostState, AwSdHostClass,
+ AW_SDHOST, TYPE_AW_SDHOST)
/** @} */
diff --git a/include/hw/sd/aspeed_sdhci.h b/include/hw/sd/aspeed_sdhci.h
index 527075476b..783ccc2956 100644
--- a/include/hw/sd/aspeed_sdhci.h
+++ b/include/hw/sd/aspeed_sdhci.h
@@ -14,8 +14,8 @@
#define TYPE_ASPEED_SDHCI "aspeed.sdhci"
typedef struct AspeedSDHCIState AspeedSDHCIState;
-#define ASPEED_SDHCI(obj) OBJECT_CHECK(AspeedSDHCIState, (obj), \
- TYPE_ASPEED_SDHCI)
+DECLARE_INSTANCE_CHECKER(AspeedSDHCIState, ASPEED_SDHCI,
+ TYPE_ASPEED_SDHCI)
#define ASPEED_SDHCI_CAPABILITIES 0x01E80080
#define ASPEED_SDHCI_NUM_SLOTS 2
diff --git a/include/hw/sd/bcm2835_sdhost.h b/include/hw/sd/bcm2835_sdhost.h
index 233e74b002..751ba531d6 100644
--- a/include/hw/sd/bcm2835_sdhost.h
+++ b/include/hw/sd/bcm2835_sdhost.h
@@ -20,8 +20,8 @@
#define TYPE_BCM2835_SDHOST "bcm2835-sdhost"
typedef struct BCM2835SDHostState BCM2835SDHostState;
-#define BCM2835_SDHOST(obj) \
- OBJECT_CHECK(BCM2835SDHostState, (obj), TYPE_BCM2835_SDHOST)
+DECLARE_INSTANCE_CHECKER(BCM2835SDHostState, BCM2835_SDHOST,
+ TYPE_BCM2835_SDHOST)
#define BCM2835_SDHOST_FIFO_LEN 16
diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h
index 850740ea92..31ccbeab0e 100644
--- a/include/hw/sd/sd.h
+++ b/include/hw/sd/sd.h
@@ -94,11 +94,8 @@ typedef struct SDBus SDBus;
#define TYPE_SD_CARD "sd-card"
typedef struct SDCardClass SDCardClass;
-#define SD_CARD(obj) OBJECT_CHECK(SDState, (obj), TYPE_SD_CARD)
-#define SD_CARD_CLASS(klass) \
- OBJECT_CLASS_CHECK(SDCardClass, (klass), TYPE_SD_CARD)
-#define SD_CARD_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SDCardClass, (obj), TYPE_SD_CARD)
+DECLARE_OBJ_CHECKERS(SDState, SDCardClass,
+ SD_CARD, TYPE_SD_CARD)
struct SDCardClass {
/*< private >*/
@@ -134,9 +131,8 @@ struct SDCardClass {
#define TYPE_SD_BUS "sd-bus"
typedef struct SDBusClass SDBusClass;
-#define SD_BUS(obj) OBJECT_CHECK(SDBus, (obj), TYPE_SD_BUS)
-#define SD_BUS_CLASS(klass) OBJECT_CLASS_CHECK(SDBusClass, (klass), TYPE_SD_BUS)
-#define SD_BUS_GET_CLASS(obj) OBJECT_GET_CLASS(SDBusClass, (obj), TYPE_SD_BUS)
+DECLARE_OBJ_CHECKERS(SDBus, SDBusClass,
+ SD_BUS, TYPE_SD_BUS)
struct SDBus {
BusState qbus;
diff --git a/include/hw/sd/sdhci.h b/include/hw/sd/sdhci.h
index 67b01fcb28..01a64c5442 100644
--- a/include/hw/sd/sdhci.h
+++ b/include/hw/sd/sdhci.h
@@ -115,11 +115,12 @@ typedef struct SDHCIState SDHCIState;
#define SDHCI_QUIRK_NO_BUSY_IRQ BIT(14)
#define TYPE_PCI_SDHCI "sdhci-pci"
-#define PCI_SDHCI(obj) OBJECT_CHECK(SDHCIState, (obj), TYPE_PCI_SDHCI)
+DECLARE_INSTANCE_CHECKER(SDHCIState, PCI_SDHCI,
+ TYPE_PCI_SDHCI)
#define TYPE_SYSBUS_SDHCI "generic-sdhci"
-#define SYSBUS_SDHCI(obj) \
- OBJECT_CHECK(SDHCIState, (obj), TYPE_SYSBUS_SDHCI)
+DECLARE_INSTANCE_CHECKER(SDHCIState, SYSBUS_SDHCI,
+ TYPE_SYSBUS_SDHCI)
#define TYPE_IMX_USDHC "imx-usdhc"
diff --git a/include/hw/southbridge/piix.h b/include/hw/southbridge/piix.h
index 21ad6327d2..6387f2b612 100644
--- a/include/hw/southbridge/piix.h
+++ b/include/hw/southbridge/piix.h
@@ -67,8 +67,8 @@ struct PIIXState {
typedef struct PIIXState PIIX3State;
#define TYPE_PIIX3_PCI_DEVICE "pci-piix3"
-#define PIIX3_PCI_DEVICE(obj) \
- OBJECT_CHECK(PIIX3State, (obj), TYPE_PIIX3_PCI_DEVICE)
+DECLARE_INSTANCE_CHECKER(PIIX3State, PIIX3_PCI_DEVICE,
+ TYPE_PIIX3_PCI_DEVICE)
extern PCIDevice *piix4_dev;
diff --git a/include/hw/sparc/sparc32_dma.h b/include/hw/sparc/sparc32_dma.h
index 9c80ef54ff..a402665a9c 100644
--- a/include/hw/sparc/sparc32_dma.h
+++ b/include/hw/sparc/sparc32_dma.h
@@ -10,8 +10,8 @@
#define TYPE_SPARC32_DMA_DEVICE "sparc32-dma-device"
typedef struct DMADeviceState DMADeviceState;
-#define SPARC32_DMA_DEVICE(obj) OBJECT_CHECK(DMADeviceState, (obj), \
- TYPE_SPARC32_DMA_DEVICE)
+DECLARE_INSTANCE_CHECKER(DMADeviceState, SPARC32_DMA_DEVICE,
+ TYPE_SPARC32_DMA_DEVICE)
struct DMADeviceState {
@@ -26,8 +26,8 @@ struct DMADeviceState {
#define TYPE_SPARC32_ESPDMA_DEVICE "sparc32-espdma"
typedef struct ESPDMADeviceState ESPDMADeviceState;
-#define SPARC32_ESPDMA_DEVICE(obj) OBJECT_CHECK(ESPDMADeviceState, (obj), \
- TYPE_SPARC32_ESPDMA_DEVICE)
+DECLARE_INSTANCE_CHECKER(ESPDMADeviceState, SPARC32_ESPDMA_DEVICE,
+ TYPE_SPARC32_ESPDMA_DEVICE)
struct ESPDMADeviceState {
DMADeviceState parent_obj;
@@ -37,8 +37,8 @@ struct ESPDMADeviceState {
#define TYPE_SPARC32_LEDMA_DEVICE "sparc32-ledma"
typedef struct LEDMADeviceState LEDMADeviceState;
-#define SPARC32_LEDMA_DEVICE(obj) OBJECT_CHECK(LEDMADeviceState, (obj), \
- TYPE_SPARC32_LEDMA_DEVICE)
+DECLARE_INSTANCE_CHECKER(LEDMADeviceState, SPARC32_LEDMA_DEVICE,
+ TYPE_SPARC32_LEDMA_DEVICE)
struct LEDMADeviceState {
DMADeviceState parent_obj;
@@ -48,8 +48,8 @@ struct LEDMADeviceState {
#define TYPE_SPARC32_DMA "sparc32-dma"
typedef struct SPARC32DMAState SPARC32DMAState;
-#define SPARC32_DMA(obj) OBJECT_CHECK(SPARC32DMAState, (obj), \
- TYPE_SPARC32_DMA)
+DECLARE_INSTANCE_CHECKER(SPARC32DMAState, SPARC32_DMA,
+ TYPE_SPARC32_DMA)
struct SPARC32DMAState {
SysBusDevice parent_obj;
diff --git a/include/hw/sparc/sun4m_iommu.h b/include/hw/sparc/sun4m_iommu.h
index 6095eed0af..4e2ab34cde 100644
--- a/include/hw/sparc/sun4m_iommu.h
+++ b/include/hw/sparc/sun4m_iommu.h
@@ -45,7 +45,8 @@ struct IOMMUState {
typedef struct IOMMUState IOMMUState;
#define TYPE_SUN4M_IOMMU "sun4m-iommu"
-#define SUN4M_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4M_IOMMU)
+DECLARE_INSTANCE_CHECKER(IOMMUState, SUN4M_IOMMU,
+ TYPE_SUN4M_IOMMU)
#define TYPE_SUN4M_IOMMU_MEMORY_REGION "sun4m-iommu-memory-region"
diff --git a/include/hw/sparc/sun4u_iommu.h b/include/hw/sparc/sun4u_iommu.h
index dfe10459e5..f94566a72c 100644
--- a/include/hw/sparc/sun4u_iommu.h
+++ b/include/hw/sparc/sun4u_iommu.h
@@ -44,7 +44,8 @@ struct IOMMUState {
typedef struct IOMMUState IOMMUState;
#define TYPE_SUN4U_IOMMU "sun4u-iommu"
-#define SUN4U_IOMMU(obj) OBJECT_CHECK(IOMMUState, (obj), TYPE_SUN4U_IOMMU)
+DECLARE_INSTANCE_CHECKER(IOMMUState, SUN4U_IOMMU,
+ TYPE_SUN4U_IOMMU)
#define TYPE_SUN4U_IOMMU_MEMORY_REGION "sun4u-iommu-memory-region"
diff --git a/include/hw/ssi/aspeed_smc.h b/include/hw/ssi/aspeed_smc.h
index a2072ffeea..8e023d8ff6 100644
--- a/include/hw/ssi/aspeed_smc.h
+++ b/include/hw/ssi/aspeed_smc.h
@@ -70,11 +70,8 @@ typedef struct AspeedSMCFlash {
#define TYPE_ASPEED_SMC "aspeed.smc"
typedef struct AspeedSMCClass AspeedSMCClass;
typedef struct AspeedSMCState AspeedSMCState;
-#define ASPEED_SMC(obj) OBJECT_CHECK(AspeedSMCState, (obj), TYPE_ASPEED_SMC)
-#define ASPEED_SMC_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedSMCClass, (klass), TYPE_ASPEED_SMC)
-#define ASPEED_SMC_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedSMCClass, (obj), TYPE_ASPEED_SMC)
+DECLARE_OBJ_CHECKERS(AspeedSMCState, AspeedSMCClass,
+ ASPEED_SMC, TYPE_ASPEED_SMC)
struct AspeedSMCClass {
SysBusDevice parent_obj;
diff --git a/include/hw/ssi/imx_spi.h b/include/hw/ssi/imx_spi.h
index 3a966af0ec..874fea492d 100644
--- a/include/hw/ssi/imx_spi.h
+++ b/include/hw/ssi/imx_spi.h
@@ -79,7 +79,8 @@
#define TYPE_IMX_SPI "imx.spi"
typedef struct IMXSPIState IMXSPIState;
-#define IMX_SPI(obj) OBJECT_CHECK(IMXSPIState, (obj), TYPE_IMX_SPI)
+DECLARE_INSTANCE_CHECKER(IMXSPIState, IMX_SPI,
+ TYPE_IMX_SPI)
struct IMXSPIState {
/* <private> */
diff --git a/include/hw/ssi/mss-spi.h b/include/hw/ssi/mss-spi.h
index 40e1a5ac90..7c16cf6b49 100644
--- a/include/hw/ssi/mss-spi.h
+++ b/include/hw/ssi/mss-spi.h
@@ -32,7 +32,8 @@
#define TYPE_MSS_SPI "mss-spi"
typedef struct MSSSpiState MSSSpiState;
-#define MSS_SPI(obj) OBJECT_CHECK(MSSSpiState, (obj), TYPE_MSS_SPI)
+DECLARE_INSTANCE_CHECKER(MSSSpiState, MSS_SPI,
+ TYPE_MSS_SPI)
#define R_SPI_MAX 16
diff --git a/include/hw/ssi/pl022.h b/include/hw/ssi/pl022.h
index 64aeb61eef..1f5da7cc44 100644
--- a/include/hw/ssi/pl022.h
+++ b/include/hw/ssi/pl022.h
@@ -26,7 +26,8 @@
#define TYPE_PL022 "pl022"
typedef struct PL022State PL022State;
-#define PL022(obj) OBJECT_CHECK(PL022State, (obj), TYPE_PL022)
+DECLARE_INSTANCE_CHECKER(PL022State, PL022,
+ TYPE_PL022)
struct PL022State {
SysBusDevice parent_obj;
diff --git a/include/hw/ssi/ssi.h b/include/hw/ssi/ssi.h
index b42765f415..b9286989fc 100644
--- a/include/hw/ssi/ssi.h
+++ b/include/hw/ssi/ssi.h
@@ -19,12 +19,8 @@ typedef struct SSISlaveClass SSISlaveClass;
typedef enum SSICSMode SSICSMode;
#define TYPE_SSI_SLAVE "ssi-slave"
-#define SSI_SLAVE(obj) \
- OBJECT_CHECK(SSISlave, (obj), TYPE_SSI_SLAVE)
-#define SSI_SLAVE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SSISlaveClass, (klass), TYPE_SSI_SLAVE)
-#define SSI_SLAVE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SSISlaveClass, (obj), TYPE_SSI_SLAVE)
+DECLARE_OBJ_CHECKERS(SSISlave, SSISlaveClass,
+ SSI_SLAVE, TYPE_SSI_SLAVE)
#define SSI_GPIO_CS "ssi-gpio-cs"
diff --git a/include/hw/ssi/stm32f2xx_spi.h b/include/hw/ssi/stm32f2xx_spi.h
index 1c8ff7d724..4bb36d04ed 100644
--- a/include/hw/ssi/stm32f2xx_spi.h
+++ b/include/hw/ssi/stm32f2xx_spi.h
@@ -46,8 +46,8 @@
#define TYPE_STM32F2XX_SPI "stm32f2xx-spi"
typedef struct STM32F2XXSPIState STM32F2XXSPIState;
-#define STM32F2XX_SPI(obj) \
- OBJECT_CHECK(STM32F2XXSPIState, (obj), TYPE_STM32F2XX_SPI)
+DECLARE_INSTANCE_CHECKER(STM32F2XXSPIState, STM32F2XX_SPI,
+ TYPE_STM32F2XX_SPI)
struct STM32F2XXSPIState {
/* <private> */
diff --git a/include/hw/ssi/xilinx_spips.h b/include/hw/ssi/xilinx_spips.h
index 2171018601..b1ab347617 100644
--- a/include/hw/ssi/xilinx_spips.h
+++ b/include/hw/ssi/xilinx_spips.h
@@ -136,17 +136,13 @@ typedef struct XilinxSPIPSClass XilinxSPIPSClass;
#define TYPE_XILINX_QSPIPS "xlnx.ps7-qspi"
#define TYPE_XLNX_ZYNQMP_QSPIPS "xlnx.usmp-gqspi"
-#define XILINX_SPIPS(obj) \
- OBJECT_CHECK(XilinxSPIPS, (obj), TYPE_XILINX_SPIPS)
-#define XILINX_SPIPS_CLASS(klass) \
- OBJECT_CLASS_CHECK(XilinxSPIPSClass, (klass), TYPE_XILINX_SPIPS)
-#define XILINX_SPIPS_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XilinxSPIPSClass, (obj), TYPE_XILINX_SPIPS)
-
-#define XILINX_QSPIPS(obj) \
- OBJECT_CHECK(XilinxQSPIPS, (obj), TYPE_XILINX_QSPIPS)
-
-#define XLNX_ZYNQMP_QSPIPS(obj) \
- OBJECT_CHECK(XlnxZynqMPQSPIPS, (obj), TYPE_XLNX_ZYNQMP_QSPIPS)
+DECLARE_OBJ_CHECKERS(XilinxSPIPS, XilinxSPIPSClass,
+ XILINX_SPIPS, TYPE_XILINX_SPIPS)
+
+DECLARE_INSTANCE_CHECKER(XilinxQSPIPS, XILINX_QSPIPS,
+ TYPE_XILINX_QSPIPS)
+
+DECLARE_INSTANCE_CHECKER(XlnxZynqMPQSPIPS, XLNX_ZYNQMP_QSPIPS,
+ TYPE_XLNX_ZYNQMP_QSPIPS)
#endif /* XILINX_SPIPS_H */
diff --git a/include/hw/stream.h b/include/hw/stream.h
index bd41750e94..e39d5a5b55 100644
--- a/include/hw/stream.h
+++ b/include/hw/stream.h
@@ -7,10 +7,8 @@
#define TYPE_STREAM_SLAVE "stream-slave"
typedef struct StreamSlaveClass StreamSlaveClass;
-#define STREAM_SLAVE_CLASS(klass) \
- OBJECT_CLASS_CHECK(StreamSlaveClass, (klass), TYPE_STREAM_SLAVE)
-#define STREAM_SLAVE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(StreamSlaveClass, (obj), TYPE_STREAM_SLAVE)
+DECLARE_CLASS_CHECKERS(StreamSlaveClass, STREAM_SLAVE,
+ TYPE_STREAM_SLAVE)
#define STREAM_SLAVE(obj) \
INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE)
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 3537e43f23..77e21bba18 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -11,18 +11,15 @@
#define QDEV_MAX_PIO 32
#define TYPE_SYSTEM_BUS "System"
-#define SYSTEM_BUS(obj) OBJECT_CHECK(BusState, (obj), TYPE_SYSTEM_BUS)
+DECLARE_INSTANCE_CHECKER(BusState, SYSTEM_BUS,
+ TYPE_SYSTEM_BUS)
typedef struct SysBusDevice SysBusDevice;
#define TYPE_SYS_BUS_DEVICE "sys-bus-device"
typedef struct SysBusDeviceClass SysBusDeviceClass;
-#define SYS_BUS_DEVICE(obj) \
- OBJECT_CHECK(SysBusDevice, (obj), TYPE_SYS_BUS_DEVICE)
-#define SYS_BUS_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(SysBusDeviceClass, (klass), TYPE_SYS_BUS_DEVICE)
-#define SYS_BUS_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(SysBusDeviceClass, (obj), TYPE_SYS_BUS_DEVICE)
+DECLARE_OBJ_CHECKERS(SysBusDevice, SysBusDeviceClass,
+ SYS_BUS_DEVICE, TYPE_SYS_BUS_DEVICE)
/**
* SysBusDeviceClass:
diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h
index 88811c6c8f..f6fcc4bfc6 100644
--- a/include/hw/timer/a9gtimer.h
+++ b/include/hw/timer/a9gtimer.h
@@ -30,7 +30,8 @@
#define TYPE_A9_GTIMER "arm.cortex-a9-global-timer"
typedef struct A9GTimerState A9GTimerState;
-#define A9_GTIMER(obj) OBJECT_CHECK(A9GTimerState, (obj), TYPE_A9_GTIMER)
+DECLARE_INSTANCE_CHECKER(A9GTimerState, A9_GTIMER,
+ TYPE_A9_GTIMER)
#define R_COUNTER_LO 0x00
#define R_COUNTER_HI 0x04
diff --git a/include/hw/timer/allwinner-a10-pit.h b/include/hw/timer/allwinner-a10-pit.h
index fa060c684d..9638e3c84c 100644
--- a/include/hw/timer/allwinner-a10-pit.h
+++ b/include/hw/timer/allwinner-a10-pit.h
@@ -7,7 +7,8 @@
#define TYPE_AW_A10_PIT "allwinner-A10-timer"
typedef struct AwA10PITState AwA10PITState;
-#define AW_A10_PIT(obj) OBJECT_CHECK(AwA10PITState, (obj), TYPE_AW_A10_PIT)
+DECLARE_INSTANCE_CHECKER(AwA10PITState, AW_A10_PIT,
+ TYPE_AW_A10_PIT)
#define AW_A10_PIT_TIMER_NR 6
#define AW_A10_PIT_TIMER_IRQ 0x1
diff --git a/include/hw/timer/arm_mptimer.h b/include/hw/timer/arm_mptimer.h
index 643a256ecf..47d5e51686 100644
--- a/include/hw/timer/arm_mptimer.h
+++ b/include/hw/timer/arm_mptimer.h
@@ -37,8 +37,8 @@ typedef struct {
#define TYPE_ARM_MPTIMER "arm_mptimer"
typedef struct ARMMPTimerState ARMMPTimerState;
-#define ARM_MPTIMER(obj) \
- OBJECT_CHECK(ARMMPTimerState, (obj), TYPE_ARM_MPTIMER)
+DECLARE_INSTANCE_CHECKER(ARMMPTimerState, ARM_MPTIMER,
+ TYPE_ARM_MPTIMER)
struct ARMMPTimerState {
/*< private >*/
diff --git a/include/hw/timer/armv7m_systick.h b/include/hw/timer/armv7m_systick.h
index 33df057958..b605688fee 100644
--- a/include/hw/timer/armv7m_systick.h
+++ b/include/hw/timer/armv7m_systick.h
@@ -18,7 +18,8 @@
#define TYPE_SYSTICK "armv7m_systick"
typedef struct SysTickState SysTickState;
-#define SYSTICK(obj) OBJECT_CHECK(SysTickState, (obj), TYPE_SYSTICK)
+DECLARE_INSTANCE_CHECKER(SysTickState, SYSTICK,
+ TYPE_SYSTICK)
struct SysTickState {
/*< private >*/
diff --git a/include/hw/timer/aspeed_timer.h b/include/hw/timer/aspeed_timer.h
index c890aaa949..4c76f955c9 100644
--- a/include/hw/timer/aspeed_timer.h
+++ b/include/hw/timer/aspeed_timer.h
@@ -29,8 +29,8 @@
#define TYPE_ASPEED_TIMER "aspeed.timer"
typedef struct AspeedTimerClass AspeedTimerClass;
typedef struct AspeedTimerCtrlState AspeedTimerCtrlState;
-#define ASPEED_TIMER(obj) \
- OBJECT_CHECK(AspeedTimerCtrlState, (obj), TYPE_ASPEED_TIMER)
+DECLARE_OBJ_CHECKERS(AspeedTimerCtrlState, AspeedTimerClass,
+ ASPEED_TIMER, TYPE_ASPEED_TIMER)
#define TYPE_ASPEED_2400_TIMER TYPE_ASPEED_TIMER "-ast2400"
#define TYPE_ASPEED_2500_TIMER TYPE_ASPEED_TIMER "-ast2500"
#define TYPE_ASPEED_2600_TIMER TYPE_ASPEED_TIMER "-ast2600"
@@ -69,10 +69,6 @@ struct AspeedTimerCtrlState {
AspeedSCUState *scu;
};
-#define ASPEED_TIMER_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedTimerClass, (klass), TYPE_ASPEED_TIMER)
-#define ASPEED_TIMER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedTimerClass, (obj), TYPE_ASPEED_TIMER)
struct AspeedTimerClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/timer/avr_timer16.h b/include/hw/timer/avr_timer16.h
index 9efe75ce5e..d454bb31cb 100644
--- a/include/hw/timer/avr_timer16.h
+++ b/include/hw/timer/avr_timer16.h
@@ -43,8 +43,8 @@ enum NextInterrupt {
#define TYPE_AVR_TIMER16 "avr-timer16"
typedef struct AVRTimer16State AVRTimer16State;
-#define AVR_TIMER16(obj) \
- OBJECT_CHECK(AVRTimer16State, (obj), TYPE_AVR_TIMER16)
+DECLARE_INSTANCE_CHECKER(AVRTimer16State, AVR_TIMER16,
+ TYPE_AVR_TIMER16)
struct AVRTimer16State {
/* <private> */
diff --git a/include/hw/timer/bcm2835_systmr.h b/include/hw/timer/bcm2835_systmr.h
index 796f62cf88..64166bd712 100644
--- a/include/hw/timer/bcm2835_systmr.h
+++ b/include/hw/timer/bcm2835_systmr.h
@@ -15,8 +15,8 @@
#define TYPE_BCM2835_SYSTIMER "bcm2835-sys-timer"
typedef struct BCM2835SystemTimerState BCM2835SystemTimerState;
-#define BCM2835_SYSTIMER(obj) \
- OBJECT_CHECK(BCM2835SystemTimerState, (obj), TYPE_BCM2835_SYSTIMER)
+DECLARE_INSTANCE_CHECKER(BCM2835SystemTimerState, BCM2835_SYSTIMER,
+ TYPE_BCM2835_SYSTIMER)
struct BCM2835SystemTimerState {
/*< private >*/
diff --git a/include/hw/timer/cmsdk-apb-dualtimer.h b/include/hw/timer/cmsdk-apb-dualtimer.h
index 8a1137aec7..7a5b9df5e5 100644
--- a/include/hw/timer/cmsdk-apb-dualtimer.h
+++ b/include/hw/timer/cmsdk-apb-dualtimer.h
@@ -32,8 +32,8 @@
#define TYPE_CMSDK_APB_DUALTIMER "cmsdk-apb-dualtimer"
typedef struct CMSDKAPBDualTimer CMSDKAPBDualTimer;
-#define CMSDK_APB_DUALTIMER(obj) OBJECT_CHECK(CMSDKAPBDualTimer, (obj), \
- TYPE_CMSDK_APB_DUALTIMER)
+DECLARE_INSTANCE_CHECKER(CMSDKAPBDualTimer, CMSDK_APB_DUALTIMER,
+ TYPE_CMSDK_APB_DUALTIMER)
/* One of the two identical timer modules in the dual-timer module */
diff --git a/include/hw/timer/cmsdk-apb-timer.h b/include/hw/timer/cmsdk-apb-timer.h
index a7ca523529..0912bc0f3c 100644
--- a/include/hw/timer/cmsdk-apb-timer.h
+++ b/include/hw/timer/cmsdk-apb-timer.h
@@ -19,8 +19,8 @@
#define TYPE_CMSDK_APB_TIMER "cmsdk-apb-timer"
typedef struct CMSDKAPBTIMER CMSDKAPBTIMER;
-#define CMSDK_APB_TIMER(obj) OBJECT_CHECK(CMSDKAPBTIMER, (obj), \
- TYPE_CMSDK_APB_TIMER)
+DECLARE_INSTANCE_CHECKER(CMSDKAPBTIMER, CMSDK_APB_TIMER,
+ TYPE_CMSDK_APB_TIMER)
struct CMSDKAPBTIMER {
/*< private >*/
diff --git a/include/hw/timer/digic-timer.h b/include/hw/timer/digic-timer.h
index 543bf8c6be..84a0ef473a 100644
--- a/include/hw/timer/digic-timer.h
+++ b/include/hw/timer/digic-timer.h
@@ -24,7 +24,8 @@
#define TYPE_DIGIC_TIMER "digic-timer"
typedef struct DigicTimerState DigicTimerState;
-#define DIGIC_TIMER(obj) OBJECT_CHECK(DigicTimerState, (obj), TYPE_DIGIC_TIMER)
+DECLARE_INSTANCE_CHECKER(DigicTimerState, DIGIC_TIMER,
+ TYPE_DIGIC_TIMER)
#define DIGIC_TIMER_CONTROL 0x00
#define DIGIC_TIMER_CONTROL_RST 0x80000000
diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h
index 6adbc31e7e..1a522a2457 100644
--- a/include/hw/timer/i8254.h
+++ b/include/hw/timer/i8254.h
@@ -42,12 +42,8 @@ typedef struct PITChannelInfo {
#define TYPE_PIT_COMMON "pit-common"
typedef struct PITCommonState PITCommonState;
typedef struct PITCommonClass PITCommonClass;
-#define PIT_COMMON(obj) \
- OBJECT_CHECK(PITCommonState, (obj), TYPE_PIT_COMMON)
-#define PIT_COMMON_CLASS(klass) \
- OBJECT_CLASS_CHECK(PITCommonClass, (klass), TYPE_PIT_COMMON)
-#define PIT_COMMON_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PITCommonClass, (obj), TYPE_PIT_COMMON)
+DECLARE_OBJ_CHECKERS(PITCommonState, PITCommonClass,
+ PIT_COMMON, TYPE_PIT_COMMON)
#define TYPE_I8254 "isa-pit"
#define TYPE_KVM_I8254 "kvm-pit"
diff --git a/include/hw/timer/imx_epit.h b/include/hw/timer/imx_epit.h
index 1ca110caf5..39bcf81331 100644
--- a/include/hw/timer/imx_epit.h
+++ b/include/hw/timer/imx_epit.h
@@ -57,7 +57,8 @@
#define TYPE_IMX_EPIT "imx.epit"
typedef struct IMXEPITState IMXEPITState;
-#define IMX_EPIT(obj) OBJECT_CHECK(IMXEPITState, (obj), TYPE_IMX_EPIT)
+DECLARE_INSTANCE_CHECKER(IMXEPITState, IMX_EPIT,
+ TYPE_IMX_EPIT)
struct IMXEPITState {
/*< private >*/
diff --git a/include/hw/timer/imx_gpt.h b/include/hw/timer/imx_gpt.h
index b96633d8b2..ff5c8a351a 100644
--- a/include/hw/timer/imx_gpt.h
+++ b/include/hw/timer/imx_gpt.h
@@ -83,7 +83,8 @@
#define TYPE_IMX_GPT TYPE_IMX25_GPT
typedef struct IMXGPTState IMXGPTState;
-#define IMX_GPT(obj) OBJECT_CHECK(IMXGPTState, (obj), TYPE_IMX_GPT)
+DECLARE_INSTANCE_CHECKER(IMXGPTState, IMX_GPT,
+ TYPE_IMX_GPT)
struct IMXGPTState {
/*< private >*/
diff --git a/include/hw/timer/mss-timer.h b/include/hw/timer/mss-timer.h
index 011c5f1ba9..d207bae2c0 100644
--- a/include/hw/timer/mss-timer.h
+++ b/include/hw/timer/mss-timer.h
@@ -31,8 +31,8 @@
#define TYPE_MSS_TIMER "mss-timer"
typedef struct MSSTimerState MSSTimerState;
-#define MSS_TIMER(obj) OBJECT_CHECK(MSSTimerState, \
- (obj), TYPE_MSS_TIMER)
+DECLARE_INSTANCE_CHECKER(MSSTimerState, MSS_TIMER,
+ TYPE_MSS_TIMER)
/*
* There are two 32-bit down counting timers.
diff --git a/include/hw/timer/nrf51_timer.h b/include/hw/timer/nrf51_timer.h
index b4eb29bd76..4261a03b95 100644
--- a/include/hw/timer/nrf51_timer.h
+++ b/include/hw/timer/nrf51_timer.h
@@ -18,7 +18,8 @@
#include "qom/object.h"
#define TYPE_NRF51_TIMER "nrf51_soc.timer"
typedef struct NRF51TimerState NRF51TimerState;
-#define NRF51_TIMER(obj) OBJECT_CHECK(NRF51TimerState, (obj), TYPE_NRF51_TIMER)
+DECLARE_INSTANCE_CHECKER(NRF51TimerState, NRF51_TIMER,
+ TYPE_NRF51_TIMER)
#define NRF51_TIMER_REG_COUNT 4
diff --git a/include/hw/timer/renesas_cmt.h b/include/hw/timer/renesas_cmt.h
index 313f9e1965..1c0b65c1d5 100644
--- a/include/hw/timer/renesas_cmt.h
+++ b/include/hw/timer/renesas_cmt.h
@@ -15,7 +15,8 @@
#define TYPE_RENESAS_CMT "renesas-cmt"
typedef struct RCMTState RCMTState;
-#define RCMT(obj) OBJECT_CHECK(RCMTState, (obj), TYPE_RENESAS_CMT)
+DECLARE_INSTANCE_CHECKER(RCMTState, RCMT,
+ TYPE_RENESAS_CMT)
enum {
CMT_CH = 2,
diff --git a/include/hw/timer/renesas_tmr.h b/include/hw/timer/renesas_tmr.h
index e2abcb13ad..caf7eec0dc 100644
--- a/include/hw/timer/renesas_tmr.h
+++ b/include/hw/timer/renesas_tmr.h
@@ -15,7 +15,8 @@
#define TYPE_RENESAS_TMR "renesas-tmr"
typedef struct RTMRState RTMRState;
-#define RTMR(obj) OBJECT_CHECK(RTMRState, (obj), TYPE_RENESAS_TMR)
+DECLARE_INSTANCE_CHECKER(RTMRState, RTMR,
+ TYPE_RENESAS_TMR)
enum timer_event {
cmia = 0,
diff --git a/include/hw/timer/stm32f2xx_timer.h b/include/hw/timer/stm32f2xx_timer.h
index 9eb9201085..90f40f1746 100644
--- a/include/hw/timer/stm32f2xx_timer.h
+++ b/include/hw/timer/stm32f2xx_timer.h
@@ -63,8 +63,8 @@
#define TYPE_STM32F2XX_TIMER "stm32f2xx-timer"
typedef struct STM32F2XXTimerState STM32F2XXTimerState;
-#define STM32F2XXTIMER(obj) OBJECT_CHECK(STM32F2XXTimerState, \
- (obj), TYPE_STM32F2XX_TIMER)
+DECLARE_INSTANCE_CHECKER(STM32F2XXTimerState, STM32F2XXTIMER,
+ TYPE_STM32F2XX_TIMER)
struct STM32F2XXTimerState {
/* <private> */
diff --git a/include/hw/usb.h b/include/hw/usb.h
index e6ec0c891c..5783635491 100644
--- a/include/hw/usb.h
+++ b/include/hw/usb.h
@@ -266,12 +266,8 @@ struct USBDevice {
#define TYPE_USB_DEVICE "usb-device"
typedef struct USBDeviceClass USBDeviceClass;
-#define USB_DEVICE(obj) \
- OBJECT_CHECK(USBDevice, (obj), TYPE_USB_DEVICE)
-#define USB_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(USBDeviceClass, (klass), TYPE_USB_DEVICE)
-#define USB_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(USBDeviceClass, (obj), TYPE_USB_DEVICE)
+DECLARE_OBJ_CHECKERS(USBDevice, USBDeviceClass,
+ USB_DEVICE, TYPE_USB_DEVICE)
typedef void (*USBDeviceRealize)(USBDevice *dev, Error **errp);
typedef void (*USBDeviceUnrealize)(USBDevice *dev);
@@ -479,7 +475,8 @@ bool usb_host_dev_is_scsi_storage(USBDevice *usbdev);
/* usb-bus.c */
#define TYPE_USB_BUS "usb-bus"
-#define USB_BUS(obj) OBJECT_CHECK(USBBus, (obj), TYPE_USB_BUS)
+DECLARE_INSTANCE_CHECKER(USBBus, USB_BUS,
+ TYPE_USB_BUS)
struct USBBus {
BusState qbus;
diff --git a/include/hw/usb/chipidea.h b/include/hw/usb/chipidea.h
index 1db449e1c4..f0303b8721 100644
--- a/include/hw/usb/chipidea.h
+++ b/include/hw/usb/chipidea.h
@@ -13,6 +13,7 @@ struct ChipideaState {
typedef struct ChipideaState ChipideaState;
#define TYPE_CHIPIDEA "usb-chipidea"
-#define CHIPIDEA(obj) OBJECT_CHECK(ChipideaState, (obj), TYPE_CHIPIDEA)
+DECLARE_INSTANCE_CHECKER(ChipideaState, CHIPIDEA,
+ TYPE_CHIPIDEA)
#endif /* CHIPIDEA_H */
diff --git a/include/hw/usb/imx-usb-phy.h b/include/hw/usb/imx-usb-phy.h
index 9861acb5ac..f7f92fc462 100644
--- a/include/hw/usb/imx-usb-phy.h
+++ b/include/hw/usb/imx-usb-phy.h
@@ -40,7 +40,8 @@ enum IMXUsbPhyRegisters {
#define TYPE_IMX_USBPHY "imx.usbphy"
typedef struct IMXUSBPHYState IMXUSBPHYState;
-#define IMX_USBPHY(obj) OBJECT_CHECK(IMXUSBPHYState, (obj), TYPE_IMX_USBPHY)
+DECLARE_INSTANCE_CHECKER(IMXUSBPHYState, IMX_USBPHY,
+ TYPE_IMX_USBPHY)
struct IMXUSBPHYState {
/* <private> */
diff --git a/include/hw/vfio/vfio-amd-xgbe.h b/include/hw/vfio/vfio-amd-xgbe.h
index b860ac0446..a894546c02 100644
--- a/include/hw/vfio/vfio-amd-xgbe.h
+++ b/include/hw/vfio/vfio-amd-xgbe.h
@@ -40,13 +40,7 @@ struct VFIOAmdXgbeDeviceClass {
typedef struct VFIOAmdXgbeDeviceClass VFIOAmdXgbeDeviceClass;
-#define VFIO_AMD_XGBE_DEVICE(obj) \
- OBJECT_CHECK(VFIOAmdXgbeDevice, (obj), TYPE_VFIO_AMD_XGBE)
-#define VFIO_AMD_XGBE_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VFIOAmdXgbeDeviceClass, (klass), \
- TYPE_VFIO_AMD_XGBE)
-#define VFIO_AMD_XGBE_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VFIOAmdXgbeDeviceClass, (obj), \
- TYPE_VFIO_AMD_XGBE)
+DECLARE_OBJ_CHECKERS(VFIOAmdXgbeDevice, VFIOAmdXgbeDeviceClass,
+ VFIO_AMD_XGBE_DEVICE, TYPE_VFIO_AMD_XGBE)
#endif
diff --git a/include/hw/vfio/vfio-calxeda-xgmac.h b/include/hw/vfio/vfio-calxeda-xgmac.h
index b19dc2160b..8482f151dd 100644
--- a/include/hw/vfio/vfio-calxeda-xgmac.h
+++ b/include/hw/vfio/vfio-calxeda-xgmac.h
@@ -37,13 +37,7 @@ struct VFIOCalxedaXgmacDeviceClass {
};
typedef struct VFIOCalxedaXgmacDeviceClass VFIOCalxedaXgmacDeviceClass;
-#define VFIO_CALXEDA_XGMAC_DEVICE(obj) \
- OBJECT_CHECK(VFIOCalxedaXgmacDevice, (obj), TYPE_VFIO_CALXEDA_XGMAC)
-#define VFIO_CALXEDA_XGMAC_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VFIOCalxedaXgmacDeviceClass, (klass), \
- TYPE_VFIO_CALXEDA_XGMAC)
-#define VFIO_CALXEDA_XGMAC_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VFIOCalxedaXgmacDeviceClass, (obj), \
- TYPE_VFIO_CALXEDA_XGMAC)
+DECLARE_OBJ_CHECKERS(VFIOCalxedaXgmacDevice, VFIOCalxedaXgmacDeviceClass,
+ VFIO_CALXEDA_XGMAC_DEVICE, TYPE_VFIO_CALXEDA_XGMAC)
#endif
diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h
index 248c23dba7..c414c3dffc 100644
--- a/include/hw/vfio/vfio-platform.h
+++ b/include/hw/vfio/vfio-platform.h
@@ -70,11 +70,7 @@ struct VFIOPlatformDeviceClass {
};
typedef struct VFIOPlatformDeviceClass VFIOPlatformDeviceClass;
-#define VFIO_PLATFORM_DEVICE(obj) \
- OBJECT_CHECK(VFIOPlatformDevice, (obj), TYPE_VFIO_PLATFORM)
-#define VFIO_PLATFORM_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VFIOPlatformDeviceClass, (klass), TYPE_VFIO_PLATFORM)
-#define VFIO_PLATFORM_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VFIOPlatformDeviceClass, (obj), TYPE_VFIO_PLATFORM)
+DECLARE_OBJ_CHECKERS(VFIOPlatformDevice, VFIOPlatformDeviceClass,
+ VFIO_PLATFORM_DEVICE, TYPE_VFIO_PLATFORM)
#endif /* HW_VFIO_VFIO_PLATFORM_H */
diff --git a/include/hw/virtio/vhost-scsi-common.h b/include/hw/virtio/vhost-scsi-common.h
index f198f25119..5f0bf73d9d 100644
--- a/include/hw/virtio/vhost-scsi-common.h
+++ b/include/hw/virtio/vhost-scsi-common.h
@@ -21,8 +21,8 @@
#define TYPE_VHOST_SCSI_COMMON "vhost-scsi-common"
typedef struct VHostSCSICommon VHostSCSICommon;
-#define VHOST_SCSI_COMMON(obj) \
- OBJECT_CHECK(VHostSCSICommon, (obj), TYPE_VHOST_SCSI_COMMON)
+DECLARE_INSTANCE_CHECKER(VHostSCSICommon, VHOST_SCSI_COMMON,
+ TYPE_VHOST_SCSI_COMMON)
struct VHostSCSICommon {
VirtIOSCSICommon parent_obj;
diff --git a/include/hw/virtio/vhost-scsi.h b/include/hw/virtio/vhost-scsi.h
index 72ae842646..7a77644150 100644
--- a/include/hw/virtio/vhost-scsi.h
+++ b/include/hw/virtio/vhost-scsi.h
@@ -27,8 +27,8 @@ enum vhost_scsi_vq_list {
#define TYPE_VHOST_SCSI "vhost-scsi"
typedef struct VHostSCSI VHostSCSI;
-#define VHOST_SCSI(obj) \
- OBJECT_CHECK(VHostSCSI, (obj), TYPE_VHOST_SCSI)
+DECLARE_INSTANCE_CHECKER(VHostSCSI, VHOST_SCSI,
+ TYPE_VHOST_SCSI)
struct VHostSCSI {
VHostSCSICommon parent_obj;
diff --git a/include/hw/virtio/vhost-user-blk.h b/include/hw/virtio/vhost-user-blk.h
index 9d38877907..dc40ab6f11 100644
--- a/include/hw/virtio/vhost-user-blk.h
+++ b/include/hw/virtio/vhost-user-blk.h
@@ -24,8 +24,8 @@
#define TYPE_VHOST_USER_BLK "vhost-user-blk"
typedef struct VHostUserBlk VHostUserBlk;
-#define VHOST_USER_BLK(obj) \
- OBJECT_CHECK(VHostUserBlk, (obj), TYPE_VHOST_USER_BLK)
+DECLARE_INSTANCE_CHECKER(VHostUserBlk, VHOST_USER_BLK,
+ TYPE_VHOST_USER_BLK)
#define VHOST_USER_BLK_AUTO_NUM_QUEUES UINT16_MAX
diff --git a/include/hw/virtio/vhost-user-fs.h b/include/hw/virtio/vhost-user-fs.h
index fa82be0e8a..9033e6f902 100644
--- a/include/hw/virtio/vhost-user-fs.h
+++ b/include/hw/virtio/vhost-user-fs.h
@@ -22,8 +22,8 @@
#define TYPE_VHOST_USER_FS "vhost-user-fs-device"
typedef struct VHostUserFS VHostUserFS;
-#define VHOST_USER_FS(obj) \
- OBJECT_CHECK(VHostUserFS, (obj), TYPE_VHOST_USER_FS)
+DECLARE_INSTANCE_CHECKER(VHostUserFS, VHOST_USER_FS,
+ TYPE_VHOST_USER_FS)
typedef struct {
CharBackend chardev;
diff --git a/include/hw/virtio/vhost-user-scsi.h b/include/hw/virtio/vhost-user-scsi.h
index c4c4c29bf9..342d67ee9e 100644
--- a/include/hw/virtio/vhost-user-scsi.h
+++ b/include/hw/virtio/vhost-user-scsi.h
@@ -25,8 +25,8 @@
#define TYPE_VHOST_USER_SCSI "vhost-user-scsi"
typedef struct VHostUserSCSI VHostUserSCSI;
-#define VHOST_USER_SCSI(obj) \
- OBJECT_CHECK(VHostUserSCSI, (obj), TYPE_VHOST_USER_SCSI)
+DECLARE_INSTANCE_CHECKER(VHostUserSCSI, VHOST_USER_SCSI,
+ TYPE_VHOST_USER_SCSI)
struct VHostUserSCSI {
VHostSCSICommon parent_obj;
diff --git a/include/hw/virtio/vhost-user-vsock.h b/include/hw/virtio/vhost-user-vsock.h
index d7eda986b6..b3c40c16a3 100644
--- a/include/hw/virtio/vhost-user-vsock.h
+++ b/include/hw/virtio/vhost-user-vsock.h
@@ -18,8 +18,8 @@
#define TYPE_VHOST_USER_VSOCK "vhost-user-vsock-device"
typedef struct VHostUserVSock VHostUserVSock;
-#define VHOST_USER_VSOCK(obj) \
- OBJECT_CHECK(VHostUserVSock, (obj), TYPE_VHOST_USER_VSOCK)
+DECLARE_INSTANCE_CHECKER(VHostUserVSock, VHOST_USER_VSOCK,
+ TYPE_VHOST_USER_VSOCK)
typedef struct {
CharBackend chardev;
diff --git a/include/hw/virtio/vhost-vsock-common.h b/include/hw/virtio/vhost-vsock-common.h
index a181396215..60bfb68db1 100644
--- a/include/hw/virtio/vhost-vsock-common.h
+++ b/include/hw/virtio/vhost-vsock-common.h
@@ -17,8 +17,8 @@
#define TYPE_VHOST_VSOCK_COMMON "vhost-vsock-common"
typedef struct VHostVSockCommon VHostVSockCommon;
-#define VHOST_VSOCK_COMMON(obj) \
- OBJECT_CHECK(VHostVSockCommon, (obj), TYPE_VHOST_VSOCK_COMMON)
+DECLARE_INSTANCE_CHECKER(VHostVSockCommon, VHOST_VSOCK_COMMON,
+ TYPE_VHOST_VSOCK_COMMON)
enum {
VHOST_VSOCK_SAVEVM_VERSION = 0,
diff --git a/include/hw/virtio/vhost-vsock.h b/include/hw/virtio/vhost-vsock.h
index e13ff85d12..c561cc427a 100644
--- a/include/hw/virtio/vhost-vsock.h
+++ b/include/hw/virtio/vhost-vsock.h
@@ -19,8 +19,8 @@
#define TYPE_VHOST_VSOCK "vhost-vsock-device"
typedef struct VHostVSock VHostVSock;
-#define VHOST_VSOCK(obj) \
- OBJECT_CHECK(VHostVSock, (obj), TYPE_VHOST_VSOCK)
+DECLARE_INSTANCE_CHECKER(VHostVSock, VHOST_VSOCK,
+ TYPE_VHOST_VSOCK)
typedef struct {
uint64_t guest_cid;
diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-balloon.h
index a5b869a4d4..0d08f496d9 100644
--- a/include/hw/virtio/virtio-balloon.h
+++ b/include/hw/virtio/virtio-balloon.h
@@ -22,8 +22,8 @@
#define TYPE_VIRTIO_BALLOON "virtio-balloon-device"
typedef struct VirtIOBalloon VirtIOBalloon;
-#define VIRTIO_BALLOON(obj) \
- OBJECT_CHECK(VirtIOBalloon, (obj), TYPE_VIRTIO_BALLOON)
+DECLARE_INSTANCE_CHECKER(VirtIOBalloon, VIRTIO_BALLOON,
+ TYPE_VIRTIO_BALLOON)
#define VIRTIO_BALLOON_FREE_PAGE_HINT_CMD_ID_MIN 0x80000000
diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
index d299b55cb9..29c9f32353 100644
--- a/include/hw/virtio/virtio-blk.h
+++ b/include/hw/virtio/virtio-blk.h
@@ -23,8 +23,8 @@
#define TYPE_VIRTIO_BLK "virtio-blk-device"
typedef struct VirtIOBlock VirtIOBlock;
-#define VIRTIO_BLK(obj) \
- OBJECT_CHECK(VirtIOBlock, (obj), TYPE_VIRTIO_BLK)
+DECLARE_INSTANCE_CHECKER(VirtIOBlock, VIRTIO_BLK,
+ TYPE_VIRTIO_BLK)
/* This is the last element of the write scatter-gather list */
struct virtio_blk_inhdr
diff --git a/include/hw/virtio/virtio-bus.h b/include/hw/virtio/virtio-bus.h
index f3e9096370..ef8abe49c5 100644
--- a/include/hw/virtio/virtio-bus.h
+++ b/include/hw/virtio/virtio-bus.h
@@ -32,11 +32,8 @@
#define TYPE_VIRTIO_BUS "virtio-bus"
typedef struct VirtioBusClass VirtioBusClass;
typedef struct VirtioBusState VirtioBusState;
-#define VIRTIO_BUS_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtioBusClass, obj, TYPE_VIRTIO_BUS)
-#define VIRTIO_BUS_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtioBusClass, klass, TYPE_VIRTIO_BUS)
-#define VIRTIO_BUS(obj) OBJECT_CHECK(VirtioBusState, (obj), TYPE_VIRTIO_BUS)
+DECLARE_OBJ_CHECKERS(VirtioBusState, VirtioBusClass,
+ VIRTIO_BUS, TYPE_VIRTIO_BUS)
struct VirtioBusClass {
diff --git a/include/hw/virtio/virtio-crypto.h b/include/hw/virtio/virtio-crypto.h
index 4134e1b7ca..7969695983 100644
--- a/include/hw/virtio/virtio-crypto.h
+++ b/include/hw/virtio/virtio-crypto.h
@@ -33,8 +33,8 @@ do { \
#define TYPE_VIRTIO_CRYPTO "virtio-crypto-device"
typedef struct VirtIOCrypto VirtIOCrypto;
-#define VIRTIO_CRYPTO(obj) \
- OBJECT_CHECK(VirtIOCrypto, (obj), TYPE_VIRTIO_CRYPTO)
+DECLARE_INSTANCE_CHECKER(VirtIOCrypto, VIRTIO_CRYPTO,
+ TYPE_VIRTIO_CRYPTO)
#define VIRTIO_CRYPTO_GET_PARENT_CLASS(obj) \
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_CRYPTO)
diff --git a/include/hw/virtio/virtio-gpu-pci.h b/include/hw/virtio/virtio-gpu-pci.h
index d727c8cada..5201792ede 100644
--- a/include/hw/virtio/virtio-gpu-pci.h
+++ b/include/hw/virtio/virtio-gpu-pci.h
@@ -24,8 +24,8 @@ typedef struct VirtIOGPUPCIBase VirtIOGPUPCIBase;
* virtio-gpu-pci-base: This extends VirtioPCIProxy.
*/
#define TYPE_VIRTIO_GPU_PCI_BASE "virtio-gpu-pci-base"
-#define VIRTIO_GPU_PCI_BASE(obj) \
- OBJECT_CHECK(VirtIOGPUPCIBase, (obj), TYPE_VIRTIO_GPU_PCI_BASE)
+DECLARE_INSTANCE_CHECKER(VirtIOGPUPCIBase, VIRTIO_GPU_PCI_BASE,
+ TYPE_VIRTIO_GPU_PCI_BASE)
struct VirtIOGPUPCIBase {
VirtIOPCIProxy parent_obj;
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index f464004bc2..72f8689e2e 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -27,22 +27,18 @@
#define TYPE_VIRTIO_GPU_BASE "virtio-gpu-base"
typedef struct VirtIOGPUBase VirtIOGPUBase;
typedef struct VirtIOGPUBaseClass VirtIOGPUBaseClass;
-#define VIRTIO_GPU_BASE(obj) \
- OBJECT_CHECK(VirtIOGPUBase, (obj), TYPE_VIRTIO_GPU_BASE)
-#define VIRTIO_GPU_BASE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOGPUBaseClass, obj, TYPE_VIRTIO_GPU_BASE)
-#define VIRTIO_GPU_BASE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtIOGPUBaseClass, klass, TYPE_VIRTIO_GPU_BASE)
+DECLARE_OBJ_CHECKERS(VirtIOGPUBase, VirtIOGPUBaseClass,
+ VIRTIO_GPU_BASE, TYPE_VIRTIO_GPU_BASE)
#define TYPE_VIRTIO_GPU "virtio-gpu-device"
typedef struct VirtIOGPU VirtIOGPU;
-#define VIRTIO_GPU(obj) \
- OBJECT_CHECK(VirtIOGPU, (obj), TYPE_VIRTIO_GPU)
+DECLARE_INSTANCE_CHECKER(VirtIOGPU, VIRTIO_GPU,
+ TYPE_VIRTIO_GPU)
#define TYPE_VHOST_USER_GPU "vhost-user-gpu"
typedef struct VhostUserGPU VhostUserGPU;
-#define VHOST_USER_GPU(obj) \
- OBJECT_CHECK(VhostUserGPU, (obj), TYPE_VHOST_USER_GPU)
+DECLARE_INSTANCE_CHECKER(VhostUserGPU, VHOST_USER_GPU,
+ TYPE_VHOST_USER_GPU)
#define VIRTIO_ID_GPU 16
diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h
index c15e983d36..c54aa6aa72 100644
--- a/include/hw/virtio/virtio-input.h
+++ b/include/hw/virtio/virtio-input.h
@@ -21,14 +21,10 @@ typedef struct virtio_input_event virtio_input_event;
#define TYPE_VIRTIO_INPUT "virtio-input-device"
typedef struct VirtIOInput VirtIOInput;
typedef struct VirtIOInputClass VirtIOInputClass;
-#define VIRTIO_INPUT(obj) \
- OBJECT_CHECK(VirtIOInput, (obj), TYPE_VIRTIO_INPUT)
+DECLARE_OBJ_CHECKERS(VirtIOInput, VirtIOInputClass,
+ VIRTIO_INPUT, TYPE_VIRTIO_INPUT)
#define VIRTIO_INPUT_GET_PARENT_CLASS(obj) \
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT)
-#define VIRTIO_INPUT_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOInputClass, obj, TYPE_VIRTIO_INPUT)
-#define VIRTIO_INPUT_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtIOInputClass, klass, TYPE_VIRTIO_INPUT)
#define TYPE_VIRTIO_INPUT_HID "virtio-input-hid-device"
#define TYPE_VIRTIO_KEYBOARD "virtio-keyboard-device"
@@ -36,22 +32,22 @@ typedef struct VirtIOInputClass VirtIOInputClass;
#define TYPE_VIRTIO_TABLET "virtio-tablet-device"
typedef struct VirtIOInputHID VirtIOInputHID;
-#define VIRTIO_INPUT_HID(obj) \
- OBJECT_CHECK(VirtIOInputHID, (obj), TYPE_VIRTIO_INPUT_HID)
+DECLARE_INSTANCE_CHECKER(VirtIOInputHID, VIRTIO_INPUT_HID,
+ TYPE_VIRTIO_INPUT_HID)
#define VIRTIO_INPUT_HID_GET_PARENT_CLASS(obj) \
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HID)
#define TYPE_VIRTIO_INPUT_HOST "virtio-input-host-device"
typedef struct VirtIOInputHost VirtIOInputHost;
-#define VIRTIO_INPUT_HOST(obj) \
- OBJECT_CHECK(VirtIOInputHost, (obj), TYPE_VIRTIO_INPUT_HOST)
+DECLARE_INSTANCE_CHECKER(VirtIOInputHost, VIRTIO_INPUT_HOST,
+ TYPE_VIRTIO_INPUT_HOST)
#define VIRTIO_INPUT_HOST_GET_PARENT_CLASS(obj) \
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_INPUT_HOST)
#define TYPE_VHOST_USER_INPUT "vhost-user-input"
typedef struct VHostUserInput VHostUserInput;
-#define VHOST_USER_INPUT(obj) \
- OBJECT_CHECK(VHostUserInput, (obj), TYPE_VHOST_USER_INPUT)
+DECLARE_INSTANCE_CHECKER(VHostUserInput, VHOST_USER_INPUT,
+ TYPE_VHOST_USER_INPUT)
#define VHOST_USER_INPUT_GET_PARENT_CLASS(obj) \
OBJECT_GET_PARENT_CLASS(obj, TYPE_VHOST_USER_INPUT)
diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-iommu.h
index d852980b30..ae9dc566c7 100644
--- a/include/hw/virtio/virtio-iommu.h
+++ b/include/hw/virtio/virtio-iommu.h
@@ -28,8 +28,8 @@
#define TYPE_VIRTIO_IOMMU "virtio-iommu-device"
#define TYPE_VIRTIO_IOMMU_PCI "virtio-iommu-device-base"
typedef struct VirtIOIOMMU VirtIOIOMMU;
-#define VIRTIO_IOMMU(obj) \
- OBJECT_CHECK(VirtIOIOMMU, (obj), TYPE_VIRTIO_IOMMU)
+DECLARE_INSTANCE_CHECKER(VirtIOIOMMU, VIRTIO_IOMMU,
+ TYPE_VIRTIO_IOMMU)
#define TYPE_VIRTIO_IOMMU_MEMORY_REGION "virtio-iommu-memory-region"
diff --git a/include/hw/virtio/virtio-mem.h b/include/hw/virtio/virtio-mem.h
index 08e37d8e84..5f0b81a967 100644
--- a/include/hw/virtio/virtio-mem.h
+++ b/include/hw/virtio/virtio-mem.h
@@ -23,12 +23,8 @@
typedef struct VirtIOMEM VirtIOMEM;
typedef struct VirtIOMEMClass VirtIOMEMClass;
-#define VIRTIO_MEM(obj) \
- OBJECT_CHECK(VirtIOMEM, (obj), TYPE_VIRTIO_MEM)
-#define VIRTIO_MEM_CLASS(oc) \
- OBJECT_CLASS_CHECK(VirtIOMEMClass, (oc), TYPE_VIRTIO_MEM)
-#define VIRTIO_MEM_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOMEMClass, (obj), TYPE_VIRTIO_MEM)
+DECLARE_OBJ_CHECKERS(VirtIOMEM, VirtIOMEMClass,
+ VIRTIO_MEM, TYPE_VIRTIO_MEM)
#define VIRTIO_MEM_MEMDEV_PROP "memdev"
#define VIRTIO_MEM_NODE_PROP "node"
diff --git a/include/hw/virtio/virtio-mmio.h b/include/hw/virtio/virtio-mmio.h
index 947fb02d3e..dca651fd14 100644
--- a/include/hw/virtio/virtio-mmio.h
+++ b/include/hw/virtio/virtio-mmio.h
@@ -38,8 +38,8 @@
/* virtio-mmio */
#define TYPE_VIRTIO_MMIO "virtio-mmio"
typedef struct VirtIOMMIOProxy VirtIOMMIOProxy;
-#define VIRTIO_MMIO(obj) \
- OBJECT_CHECK(VirtIOMMIOProxy, (obj), TYPE_VIRTIO_MMIO)
+DECLARE_INSTANCE_CHECKER(VirtIOMMIOProxy, VIRTIO_MMIO,
+ TYPE_VIRTIO_MMIO)
#define VIRT_MAGIC 0x74726976 /* 'virt' */
#define VIRT_VERSION 2
diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h
index 2e81b5bfcb..929ed232dd 100644
--- a/include/hw/virtio/virtio-net.h
+++ b/include/hw/virtio/virtio-net.h
@@ -23,8 +23,8 @@
#define TYPE_VIRTIO_NET "virtio-net-device"
typedef struct VirtIONet VirtIONet;
-#define VIRTIO_NET(obj) \
- OBJECT_CHECK(VirtIONet, (obj), TYPE_VIRTIO_NET)
+DECLARE_INSTANCE_CHECKER(VirtIONet, VIRTIO_NET,
+ TYPE_VIRTIO_NET)
#define TX_TIMER_INTERVAL 150000 /* 150 us */
diff --git a/include/hw/virtio/virtio-pmem.h b/include/hw/virtio/virtio-pmem.h
index 56bce2be7a..6c15abad70 100644
--- a/include/hw/virtio/virtio-pmem.h
+++ b/include/hw/virtio/virtio-pmem.h
@@ -22,12 +22,8 @@
typedef struct VirtIOPMEM VirtIOPMEM;
typedef struct VirtIOPMEMClass VirtIOPMEMClass;
-#define VIRTIO_PMEM(obj) \
- OBJECT_CHECK(VirtIOPMEM, (obj), TYPE_VIRTIO_PMEM)
-#define VIRTIO_PMEM_CLASS(oc) \
- OBJECT_CLASS_CHECK(VirtIOPMEMClass, (oc), TYPE_VIRTIO_PMEM)
-#define VIRTIO_PMEM_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOPMEMClass, (obj), TYPE_VIRTIO_PMEM)
+DECLARE_OBJ_CHECKERS(VirtIOPMEM, VirtIOPMEMClass,
+ VIRTIO_PMEM, TYPE_VIRTIO_PMEM)
#define VIRTIO_PMEM_ADDR_PROP "memaddr"
#define VIRTIO_PMEM_MEMDEV_PROP "memdev"
diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h
index 34fb5f695f..3671c9ba19 100644
--- a/include/hw/virtio/virtio-rng.h
+++ b/include/hw/virtio/virtio-rng.h
@@ -19,8 +19,8 @@
#define TYPE_VIRTIO_RNG "virtio-rng-device"
typedef struct VirtIORNG VirtIORNG;
-#define VIRTIO_RNG(obj) \
- OBJECT_CHECK(VirtIORNG, (obj), TYPE_VIRTIO_RNG)
+DECLARE_INSTANCE_CHECKER(VirtIORNG, VIRTIO_RNG,
+ TYPE_VIRTIO_RNG)
#define VIRTIO_RNG_GET_PARENT_CLASS(obj) \
OBJECT_GET_PARENT_CLASS(obj, TYPE_VIRTIO_RNG)
diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h
index bbf4b9a356..9a8a06fdd1 100644
--- a/include/hw/virtio/virtio-scsi.h
+++ b/include/hw/virtio/virtio-scsi.h
@@ -27,13 +27,13 @@
#define TYPE_VIRTIO_SCSI_COMMON "virtio-scsi-common"
typedef struct VirtIOSCSICommon VirtIOSCSICommon;
-#define VIRTIO_SCSI_COMMON(obj) \
- OBJECT_CHECK(VirtIOSCSICommon, (obj), TYPE_VIRTIO_SCSI_COMMON)
+DECLARE_INSTANCE_CHECKER(VirtIOSCSICommon, VIRTIO_SCSI_COMMON,
+ TYPE_VIRTIO_SCSI_COMMON)
#define TYPE_VIRTIO_SCSI "virtio-scsi-device"
typedef struct VirtIOSCSI VirtIOSCSI;
-#define VIRTIO_SCSI(obj) \
- OBJECT_CHECK(VirtIOSCSI, (obj), TYPE_VIRTIO_SCSI)
+DECLARE_INSTANCE_CHECKER(VirtIOSCSI, VIRTIO_SCSI,
+ TYPE_VIRTIO_SCSI)
#define VIRTIO_SCSI_MAX_CHANNEL 0
#define VIRTIO_SCSI_MAX_TARGET 255
diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h
index 94da09ec34..bbc76d5032 100644
--- a/include/hw/virtio/virtio-serial.h
+++ b/include/hw/virtio/virtio-serial.h
@@ -28,19 +28,15 @@ struct virtio_serial_conf {
#define TYPE_VIRTIO_SERIAL_PORT "virtio-serial-port"
typedef struct VirtIOSerialPort VirtIOSerialPort;
typedef struct VirtIOSerialPortClass VirtIOSerialPortClass;
-#define VIRTIO_SERIAL_PORT(obj) \
- OBJECT_CHECK(VirtIOSerialPort, (obj), TYPE_VIRTIO_SERIAL_PORT)
-#define VIRTIO_SERIAL_PORT_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtIOSerialPortClass, (klass), TYPE_VIRTIO_SERIAL_PORT)
-#define VIRTIO_SERIAL_PORT_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtIOSerialPortClass, (obj), TYPE_VIRTIO_SERIAL_PORT)
+DECLARE_OBJ_CHECKERS(VirtIOSerialPort, VirtIOSerialPortClass,
+ VIRTIO_SERIAL_PORT, TYPE_VIRTIO_SERIAL_PORT)
typedef struct VirtIOSerial VirtIOSerial;
#define TYPE_VIRTIO_SERIAL_BUS "virtio-serial-bus"
typedef struct VirtIOSerialBus VirtIOSerialBus;
-#define VIRTIO_SERIAL_BUS(obj) \
- OBJECT_CHECK(VirtIOSerialBus, (obj), TYPE_VIRTIO_SERIAL_BUS)
+DECLARE_INSTANCE_CHECKER(VirtIOSerialBus, VIRTIO_SERIAL_BUS,
+ TYPE_VIRTIO_SERIAL_BUS)
struct VirtIOSerialPortClass {
@@ -230,7 +226,7 @@ size_t virtio_serial_guest_ready(VirtIOSerialPort *port);
void virtio_serial_throttle_port(VirtIOSerialPort *port, bool throttle);
#define TYPE_VIRTIO_SERIAL "virtio-serial-device"
-#define VIRTIO_SERIAL(obj) \
- OBJECT_CHECK(VirtIOSerial, (obj), TYPE_VIRTIO_SERIAL)
+DECLARE_INSTANCE_CHECKER(VirtIOSerial, VIRTIO_SERIAL,
+ TYPE_VIRTIO_SERIAL)
#endif
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 261d087de8..807280451b 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -69,12 +69,8 @@ typedef struct VirtQueueElement
#define TYPE_VIRTIO_DEVICE "virtio-device"
typedef struct VirtioDeviceClass VirtioDeviceClass;
-#define VIRTIO_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VirtioDeviceClass, obj, TYPE_VIRTIO_DEVICE)
-#define VIRTIO_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(VirtioDeviceClass, klass, TYPE_VIRTIO_DEVICE)
-#define VIRTIO_DEVICE(obj) \
- OBJECT_CHECK(VirtIODevice, (obj), TYPE_VIRTIO_DEVICE)
+DECLARE_OBJ_CHECKERS(VirtIODevice, VirtioDeviceClass,
+ VIRTIO_DEVICE, TYPE_VIRTIO_DEVICE)
enum virtio_device_endian {
VIRTIO_DEVICE_ENDIAN_UNKNOWN,
diff --git a/include/hw/vmstate-if.h b/include/hw/vmstate-if.h
index eabf5b05ad..52df571d17 100644
--- a/include/hw/vmstate-if.h
+++ b/include/hw/vmstate-if.h
@@ -14,10 +14,8 @@
#define TYPE_VMSTATE_IF "vmstate-if"
typedef struct VMStateIfClass VMStateIfClass;
-#define VMSTATE_IF_CLASS(klass) \
- OBJECT_CLASS_CHECK(VMStateIfClass, (klass), TYPE_VMSTATE_IF)
-#define VMSTATE_IF_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VMStateIfClass, (obj), TYPE_VMSTATE_IF)
+DECLARE_CLASS_CHECKERS(VMStateIfClass, VMSTATE_IF,
+ TYPE_VMSTATE_IF)
#define VMSTATE_IF(obj) \
INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
diff --git a/include/hw/watchdog/cmsdk-apb-watchdog.h b/include/hw/watchdog/cmsdk-apb-watchdog.h
index be2983eefa..63f4becf86 100644
--- a/include/hw/watchdog/cmsdk-apb-watchdog.h
+++ b/include/hw/watchdog/cmsdk-apb-watchdog.h
@@ -37,8 +37,8 @@
#define TYPE_CMSDK_APB_WATCHDOG "cmsdk-apb-watchdog"
typedef struct CMSDKAPBWatchdog CMSDKAPBWatchdog;
-#define CMSDK_APB_WATCHDOG(obj) OBJECT_CHECK(CMSDKAPBWatchdog, (obj), \
- TYPE_CMSDK_APB_WATCHDOG)
+DECLARE_INSTANCE_CHECKER(CMSDKAPBWatchdog, CMSDK_APB_WATCHDOG,
+ TYPE_CMSDK_APB_WATCHDOG)
/*
* This shares the same struct (and cast macro) as the base
diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h
index ba9a0a1fd8..2ca1eb5432 100644
--- a/include/hw/watchdog/wdt_aspeed.h
+++ b/include/hw/watchdog/wdt_aspeed.h
@@ -17,8 +17,8 @@
#define TYPE_ASPEED_WDT "aspeed.wdt"
typedef struct AspeedWDTClass AspeedWDTClass;
typedef struct AspeedWDTState AspeedWDTState;
-#define ASPEED_WDT(obj) \
- OBJECT_CHECK(AspeedWDTState, (obj), TYPE_ASPEED_WDT)
+DECLARE_OBJ_CHECKERS(AspeedWDTState, AspeedWDTClass,
+ ASPEED_WDT, TYPE_ASPEED_WDT)
#define TYPE_ASPEED_2400_WDT TYPE_ASPEED_WDT "-ast2400"
#define TYPE_ASPEED_2500_WDT TYPE_ASPEED_WDT "-ast2500"
#define TYPE_ASPEED_2600_WDT TYPE_ASPEED_WDT "-ast2600"
@@ -38,10 +38,6 @@ struct AspeedWDTState {
uint32_t pclk_freq;
};
-#define ASPEED_WDT_CLASS(klass) \
- OBJECT_CLASS_CHECK(AspeedWDTClass, (klass), TYPE_ASPEED_WDT)
-#define ASPEED_WDT_GET_CLASS(obj) \
- OBJECT_GET_CLASS(AspeedWDTClass, (obj), TYPE_ASPEED_WDT)
struct AspeedWDTClass {
SysBusDeviceClass parent_class;
diff --git a/include/hw/watchdog/wdt_diag288.h b/include/hw/watchdog/wdt_diag288.h
index e611163821..f72c1d3318 100644
--- a/include/hw/watchdog/wdt_diag288.h
+++ b/include/hw/watchdog/wdt_diag288.h
@@ -7,12 +7,8 @@
#define TYPE_WDT_DIAG288 "diag288"
typedef struct DIAG288Class DIAG288Class;
typedef struct DIAG288State DIAG288State;
-#define DIAG288(obj) \
- OBJECT_CHECK(DIAG288State, (obj), TYPE_WDT_DIAG288)
-#define DIAG288_CLASS(klass) \
- OBJECT_CLASS_CHECK(DIAG288Class, (klass), TYPE_WDT_DIAG288)
-#define DIAG288_GET_CLASS(obj) \
- OBJECT_GET_CLASS(DIAG288Class, (obj), TYPE_WDT_DIAG288)
+DECLARE_OBJ_CHECKERS(DIAG288State, DIAG288Class,
+ DIAG288, TYPE_WDT_DIAG288)
#define WDT_DIAG288_INIT 0
#define WDT_DIAG288_CHANGE 1
diff --git a/include/hw/watchdog/wdt_imx2.h b/include/hw/watchdog/wdt_imx2.h
index 8757418b46..7665d93640 100644
--- a/include/hw/watchdog/wdt_imx2.h
+++ b/include/hw/watchdog/wdt_imx2.h
@@ -20,7 +20,8 @@
#define TYPE_IMX2_WDT "imx2.wdt"
typedef struct IMX2WdtState IMX2WdtState;
-#define IMX2_WDT(obj) OBJECT_CHECK(IMX2WdtState, (obj), TYPE_IMX2_WDT)
+DECLARE_INSTANCE_CHECKER(IMX2WdtState, IMX2_WDT,
+ TYPE_IMX2_WDT)
enum IMX2WdtRegisters {
IMX2_WDT_WCR = 0x0000, /* Control Register */
diff --git a/include/hw/xen/xen-block.h b/include/hw/xen/xen-block.h
index 54f2e35122..8ff5421dc3 100644
--- a/include/hw/xen/xen-block.h
+++ b/include/hw/xen/xen-block.h
@@ -71,12 +71,8 @@ struct XenBlockDeviceClass {
typedef struct XenBlockDeviceClass XenBlockDeviceClass;
#define TYPE_XEN_BLOCK_DEVICE "xen-block"
-#define XEN_BLOCK_DEVICE(obj) \
- OBJECT_CHECK(XenBlockDevice, (obj), TYPE_XEN_BLOCK_DEVICE)
-#define XEN_BLOCK_DEVICE_CLASS(class) \
- OBJECT_CLASS_CHECK(XenBlockDeviceClass, (class), TYPE_XEN_BLOCK_DEVICE)
-#define XEN_BLOCK_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XenBlockDeviceClass, (obj), TYPE_XEN_BLOCK_DEVICE)
+DECLARE_OBJ_CHECKERS(XenBlockDevice, XenBlockDeviceClass,
+ XEN_BLOCK_DEVICE, TYPE_XEN_BLOCK_DEVICE)
struct XenDiskDevice {
XenBlockDevice blockdev;
@@ -84,8 +80,8 @@ struct XenDiskDevice {
typedef struct XenDiskDevice XenDiskDevice;
#define TYPE_XEN_DISK_DEVICE "xen-disk"
-#define XEN_DISK_DEVICE(obj) \
- OBJECT_CHECK(XenDiskDevice, (obj), TYPE_XEN_DISK_DEVICE)
+DECLARE_INSTANCE_CHECKER(XenDiskDevice, XEN_DISK_DEVICE,
+ TYPE_XEN_DISK_DEVICE)
struct XenCDRomDevice {
XenBlockDevice blockdev;
@@ -93,7 +89,7 @@ struct XenCDRomDevice {
typedef struct XenCDRomDevice XenCDRomDevice;
#define TYPE_XEN_CDROM_DEVICE "xen-cdrom"
-#define XEN_CDROM_DEVICE(obj) \
- OBJECT_CHECK(XenCDRomDevice, (obj), TYPE_XEN_CDROM_DEVICE)
+DECLARE_INSTANCE_CHECKER(XenCDRomDevice, XEN_CDROM_DEVICE,
+ TYPE_XEN_CDROM_DEVICE)
#endif /* HW_XEN_BLOCK_H */
diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
index 910cf49161..35fec7c905 100644
--- a/include/hw/xen/xen-bus.h
+++ b/include/hw/xen/xen-bus.h
@@ -60,12 +60,8 @@ struct XenDeviceClass {
typedef struct XenDeviceClass XenDeviceClass;
#define TYPE_XEN_DEVICE "xen-device"
-#define XEN_DEVICE(obj) \
- OBJECT_CHECK(XenDevice, (obj), TYPE_XEN_DEVICE)
-#define XEN_DEVICE_CLASS(class) \
- OBJECT_CLASS_CHECK(XenDeviceClass, (class), TYPE_XEN_DEVICE)
-#define XEN_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XenDeviceClass, (obj), TYPE_XEN_DEVICE)
+DECLARE_OBJ_CHECKERS(XenDevice, XenDeviceClass,
+ XEN_DEVICE, TYPE_XEN_DEVICE)
struct XenBus {
BusState qbus;
@@ -84,12 +80,8 @@ struct XenBusClass {
typedef struct XenBusClass XenBusClass;
#define TYPE_XEN_BUS "xen-bus"
-#define XEN_BUS(obj) \
- OBJECT_CHECK(XenBus, (obj), TYPE_XEN_BUS)
-#define XEN_BUS_CLASS(class) \
- OBJECT_CLASS_CHECK(XenBusClass, (class), TYPE_XEN_BUS)
-#define XEN_BUS_GET_CLASS(obj) \
- OBJECT_GET_CLASS(XenBusClass, (obj), TYPE_XEN_BUS)
+DECLARE_OBJ_CHECKERS(XenBus, XenBusClass,
+ XEN_BUS, TYPE_XEN_BUS)
void xen_bus_init(void);
diff --git a/include/hw/xen/xen-legacy-backend.h b/include/hw/xen/xen-legacy-backend.h
index 89b51e05fc..ba7a3c59bb 100644
--- a/include/hw/xen/xen-legacy-backend.h
+++ b/include/hw/xen/xen-legacy-backend.h
@@ -11,8 +11,8 @@
#define TYPE_XENBACKEND "xen-backend"
typedef struct XenLegacyDevice XenLegacyDevice;
-#define XENBACKEND_DEVICE(obj) \
- OBJECT_CHECK(XenLegacyDevice, (obj), TYPE_XENBACKEND)
+DECLARE_INSTANCE_CHECKER(XenLegacyDevice, XENBACKEND_DEVICE,
+ TYPE_XENBACKEND)
/* variables */
extern struct xs_handle *xenstore;
diff --git a/include/io/channel-buffer.h b/include/io/channel-buffer.h
index 344d5957fd..89632ef437 100644
--- a/include/io/channel-buffer.h
+++ b/include/io/channel-buffer.h
@@ -26,8 +26,8 @@
#define TYPE_QIO_CHANNEL_BUFFER "qio-channel-buffer"
typedef struct QIOChannelBuffer QIOChannelBuffer;
-#define QIO_CHANNEL_BUFFER(obj) \
- OBJECT_CHECK(QIOChannelBuffer, (obj), TYPE_QIO_CHANNEL_BUFFER)
+DECLARE_INSTANCE_CHECKER(QIOChannelBuffer, QIO_CHANNEL_BUFFER,
+ TYPE_QIO_CHANNEL_BUFFER)
/**
diff --git a/include/io/channel-command.h b/include/io/channel-command.h
index b1671062d0..4b64ff011b 100644
--- a/include/io/channel-command.h
+++ b/include/io/channel-command.h
@@ -26,8 +26,8 @@
#define TYPE_QIO_CHANNEL_COMMAND "qio-channel-command"
typedef struct QIOChannelCommand QIOChannelCommand;
-#define QIO_CHANNEL_COMMAND(obj) \
- OBJECT_CHECK(QIOChannelCommand, (obj), TYPE_QIO_CHANNEL_COMMAND)
+DECLARE_INSTANCE_CHECKER(QIOChannelCommand, QIO_CHANNEL_COMMAND,
+ TYPE_QIO_CHANNEL_COMMAND)
diff --git a/include/io/channel-file.h b/include/io/channel-file.h
index d91c9f5bc1..c6caf179d9 100644
--- a/include/io/channel-file.h
+++ b/include/io/channel-file.h
@@ -26,8 +26,8 @@
#define TYPE_QIO_CHANNEL_FILE "qio-channel-file"
typedef struct QIOChannelFile QIOChannelFile;
-#define QIO_CHANNEL_FILE(obj) \
- OBJECT_CHECK(QIOChannelFile, (obj), TYPE_QIO_CHANNEL_FILE)
+DECLARE_INSTANCE_CHECKER(QIOChannelFile, QIO_CHANNEL_FILE,
+ TYPE_QIO_CHANNEL_FILE)
/**
diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h
index ee898d991b..62e3e2e970 100644
--- a/include/io/channel-socket.h
+++ b/include/io/channel-socket.h
@@ -28,8 +28,8 @@
#define TYPE_QIO_CHANNEL_SOCKET "qio-channel-socket"
typedef struct QIOChannelSocket QIOChannelSocket;
-#define QIO_CHANNEL_SOCKET(obj) \
- OBJECT_CHECK(QIOChannelSocket, (obj), TYPE_QIO_CHANNEL_SOCKET)
+DECLARE_INSTANCE_CHECKER(QIOChannelSocket, QIO_CHANNEL_SOCKET,
+ TYPE_QIO_CHANNEL_SOCKET)
/**
diff --git a/include/io/channel-tls.h b/include/io/channel-tls.h
index ebd42f981e..036bf54195 100644
--- a/include/io/channel-tls.h
+++ b/include/io/channel-tls.h
@@ -28,8 +28,8 @@
#define TYPE_QIO_CHANNEL_TLS "qio-channel-tls"
typedef struct QIOChannelTLS QIOChannelTLS;
-#define QIO_CHANNEL_TLS(obj) \
- OBJECT_CHECK(QIOChannelTLS, (obj), TYPE_QIO_CHANNEL_TLS)
+DECLARE_INSTANCE_CHECKER(QIOChannelTLS, QIO_CHANNEL_TLS,
+ TYPE_QIO_CHANNEL_TLS)
/**
diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h
index 5ab8811306..b07eddabe1 100644
--- a/include/io/channel-websock.h
+++ b/include/io/channel-websock.h
@@ -28,8 +28,8 @@
#define TYPE_QIO_CHANNEL_WEBSOCK "qio-channel-websock"
typedef struct QIOChannelWebsock QIOChannelWebsock;
-#define QIO_CHANNEL_WEBSOCK(obj) \
- OBJECT_CHECK(QIOChannelWebsock, (obj), TYPE_QIO_CHANNEL_WEBSOCK)
+DECLARE_INSTANCE_CHECKER(QIOChannelWebsock, QIO_CHANNEL_WEBSOCK,
+ TYPE_QIO_CHANNEL_WEBSOCK)
typedef union QIOChannelWebsockMask QIOChannelWebsockMask;
diff --git a/include/io/channel.h b/include/io/channel.h
index 67b9768eff..3ebdc7954f 100644
--- a/include/io/channel.h
+++ b/include/io/channel.h
@@ -28,12 +28,8 @@
#define TYPE_QIO_CHANNEL "qio-channel"
typedef struct QIOChannel QIOChannel;
typedef struct QIOChannelClass QIOChannelClass;
-#define QIO_CHANNEL(obj) \
- OBJECT_CHECK(QIOChannel, (obj), TYPE_QIO_CHANNEL)
-#define QIO_CHANNEL_CLASS(klass) \
- OBJECT_CLASS_CHECK(QIOChannelClass, klass, TYPE_QIO_CHANNEL)
-#define QIO_CHANNEL_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QIOChannelClass, obj, TYPE_QIO_CHANNEL)
+DECLARE_OBJ_CHECKERS(QIOChannel, QIOChannelClass,
+ QIO_CHANNEL, TYPE_QIO_CHANNEL)
#define QIO_CHANNEL_ERR_BLOCK -2
diff --git a/include/io/dns-resolver.h b/include/io/dns-resolver.h
index 5e720bf267..96a3186b6b 100644
--- a/include/io/dns-resolver.h
+++ b/include/io/dns-resolver.h
@@ -28,12 +28,8 @@
#define TYPE_QIO_DNS_RESOLVER "qio-dns-resolver"
typedef struct QIODNSResolver QIODNSResolver;
typedef struct QIODNSResolverClass QIODNSResolverClass;
-#define QIO_DNS_RESOLVER(obj) \
- OBJECT_CHECK(QIODNSResolver, (obj), TYPE_QIO_DNS_RESOLVER)
-#define QIO_DNS_RESOLVER_CLASS(klass) \
- OBJECT_CLASS_CHECK(QIODNSResolverClass, klass, TYPE_QIO_DNS_RESOLVER)
-#define QIO_DNS_RESOLVER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QIODNSResolverClass, obj, TYPE_QIO_DNS_RESOLVER)
+DECLARE_OBJ_CHECKERS(QIODNSResolver, QIODNSResolverClass,
+ QIO_DNS_RESOLVER, TYPE_QIO_DNS_RESOLVER)
/**
diff --git a/include/io/net-listener.h b/include/io/net-listener.h
index fbdd2dbf9a..93367db291 100644
--- a/include/io/net-listener.h
+++ b/include/io/net-listener.h
@@ -27,12 +27,8 @@
#define TYPE_QIO_NET_LISTENER "qio-net-listener"
typedef struct QIONetListener QIONetListener;
typedef struct QIONetListenerClass QIONetListenerClass;
-#define QIO_NET_LISTENER(obj) \
- OBJECT_CHECK(QIONetListener, (obj), TYPE_QIO_NET_LISTENER)
-#define QIO_NET_LISTENER_CLASS(klass) \
- OBJECT_CLASS_CHECK(QIONetListenerClass, klass, TYPE_QIO_NET_LISTENER)
-#define QIO_NET_LISTENER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QIONetListenerClass, obj, TYPE_QIO_NET_LISTENER)
+DECLARE_OBJ_CHECKERS(QIONetListener, QIONetListenerClass,
+ QIO_NET_LISTENER, TYPE_QIO_NET_LISTENER)
typedef void (*QIONetListenerClientFunc)(QIONetListener *listener,
diff --git a/include/net/can_emu.h b/include/net/can_emu.h
index 7e90fd8a45..150f91a657 100644
--- a/include/net/can_emu.h
+++ b/include/net/can_emu.h
@@ -100,8 +100,8 @@ struct CanBusClientState {
};
#define TYPE_CAN_BUS "can-bus"
-#define CAN_BUS(obj) \
- OBJECT_CHECK(CanBusState, (obj), TYPE_CAN_BUS)
+DECLARE_INSTANCE_CHECKER(CanBusState, CAN_BUS,
+ TYPE_CAN_BUS)
int can_bus_filter_match(struct qemu_can_filter *filter, qemu_canid_t can_id);
diff --git a/include/net/can_host.h b/include/net/can_host.h
index 13b6a191dd..18979c2e2d 100644
--- a/include/net/can_host.h
+++ b/include/net/can_host.h
@@ -34,12 +34,8 @@
#define TYPE_CAN_HOST "can-host"
typedef struct CanHostClass CanHostClass;
typedef struct CanHostState CanHostState;
-#define CAN_HOST_CLASS(klass) \
- OBJECT_CLASS_CHECK(CanHostClass, (klass), TYPE_CAN_HOST)
-#define CAN_HOST_GET_CLASS(obj) \
- OBJECT_GET_CLASS(CanHostClass, (obj), TYPE_CAN_HOST)
-#define CAN_HOST(obj) \
- OBJECT_CHECK(CanHostState, (obj), TYPE_CAN_HOST)
+DECLARE_OBJ_CHECKERS(CanHostState, CanHostClass,
+ CAN_HOST, TYPE_CAN_HOST)
struct CanHostState {
ObjectClass oc;
diff --git a/include/net/filter.h b/include/net/filter.h
index 0d4f011bc0..e7e593128a 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -16,12 +16,8 @@
#define TYPE_NETFILTER "netfilter"
typedef struct NetFilterClass NetFilterClass;
-#define NETFILTER(obj) \
- OBJECT_CHECK(NetFilterState, (obj), TYPE_NETFILTER)
-#define NETFILTER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(NetFilterClass, (obj), TYPE_NETFILTER)
-#define NETFILTER_CLASS(klass) \
- OBJECT_CLASS_CHECK(NetFilterClass, (klass), TYPE_NETFILTER)
+DECLARE_OBJ_CHECKERS(NetFilterState, NetFilterClass,
+ NETFILTER, TYPE_NETFILTER)
typedef void (FilterSetup) (NetFilterState *nf, Error **errp);
typedef void (FilterCleanup) (NetFilterState *nf);
diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h
index 2be985f86e..f118fb516b 100644
--- a/include/qom/object_interfaces.h
+++ b/include/qom/object_interfaces.h
@@ -7,12 +7,8 @@
#define TYPE_USER_CREATABLE "user-creatable"
typedef struct UserCreatableClass UserCreatableClass;
-#define USER_CREATABLE_CLASS(klass) \
- OBJECT_CLASS_CHECK(UserCreatableClass, (klass), \
- TYPE_USER_CREATABLE)
-#define USER_CREATABLE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(UserCreatableClass, (obj), \
- TYPE_USER_CREATABLE)
+DECLARE_CLASS_CHECKERS(UserCreatableClass, USER_CREATABLE,
+ TYPE_USER_CREATABLE)
#define USER_CREATABLE(obj) \
INTERFACE_CHECK(UserCreatable, (obj), \
TYPE_USER_CREATABLE)
diff --git a/include/scsi/pr-manager.h b/include/scsi/pr-manager.h
index 2c699e4030..f801fe9533 100644
--- a/include/scsi/pr-manager.h
+++ b/include/scsi/pr-manager.h
@@ -11,12 +11,8 @@
typedef struct PRManager PRManager;
typedef struct PRManagerClass PRManagerClass;
-#define PR_MANAGER_CLASS(klass) \
- OBJECT_CLASS_CHECK(PRManagerClass, (klass), TYPE_PR_MANAGER)
-#define PR_MANAGER_GET_CLASS(obj) \
- OBJECT_GET_CLASS(PRManagerClass, (obj), TYPE_PR_MANAGER)
-#define PR_MANAGER(obj) \
- OBJECT_CHECK(PRManager, (obj), TYPE_PR_MANAGER)
+DECLARE_OBJ_CHECKERS(PRManager, PRManagerClass,
+ PR_MANAGER, TYPE_PR_MANAGER)
struct sg_io_hdr;
diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h
index e11526271a..65c017cf81 100644
--- a/include/sysemu/cryptodev.h
+++ b/include/sysemu/cryptodev.h
@@ -39,15 +39,8 @@
typedef struct CryptoDevBackend CryptoDevBackend;
typedef struct CryptoDevBackendClass CryptoDevBackendClass;
-#define CRYPTODEV_BACKEND(obj) \
- OBJECT_CHECK(CryptoDevBackend, \
- (obj), TYPE_CRYPTODEV_BACKEND)
-#define CRYPTODEV_BACKEND_GET_CLASS(obj) \
- OBJECT_GET_CLASS(CryptoDevBackendClass, \
- (obj), TYPE_CRYPTODEV_BACKEND)
-#define CRYPTODEV_BACKEND_CLASS(klass) \
- OBJECT_CLASS_CHECK(CryptoDevBackendClass, \
- (klass), TYPE_CRYPTODEV_BACKEND)
+DECLARE_OBJ_CHECKERS(CryptoDevBackend, CryptoDevBackendClass,
+ CRYPTODEV_BACKEND, TYPE_CRYPTODEV_BACKEND)
#define MAX_CRYPTO_QUEUE_NUM 64
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
index 7b775b6687..1e6078f872 100644
--- a/include/sysemu/hostmem.h
+++ b/include/sysemu/hostmem.h
@@ -22,12 +22,8 @@
#define TYPE_MEMORY_BACKEND "memory-backend"
typedef struct HostMemoryBackend HostMemoryBackend;
typedef struct HostMemoryBackendClass HostMemoryBackendClass;
-#define MEMORY_BACKEND(obj) \
- OBJECT_CHECK(HostMemoryBackend, (obj), TYPE_MEMORY_BACKEND)
-#define MEMORY_BACKEND_GET_CLASS(obj) \
- OBJECT_GET_CLASS(HostMemoryBackendClass, (obj), TYPE_MEMORY_BACKEND)
-#define MEMORY_BACKEND_CLASS(klass) \
- OBJECT_CLASS_CHECK(HostMemoryBackendClass, (klass), TYPE_MEMORY_BACKEND)
+DECLARE_OBJ_CHECKERS(HostMemoryBackend, HostMemoryBackendClass,
+ MEMORY_BACKEND, TYPE_MEMORY_BACKEND)
/* hostmem-ram.c */
/**
diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h
index 566b5f52fc..1398679458 100644
--- a/include/sysemu/hvf.h
+++ b/include/sysemu/hvf.h
@@ -37,7 +37,7 @@ void hvf_vcpu_destroy(CPUState *);
#define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
typedef struct HVFState HVFState;
-#define HVF_STATE(obj) \
- OBJECT_CHECK(HVFState, (obj), TYPE_HVF_ACCEL)
+DECLARE_INSTANCE_CHECKER(HVFState, HVF_STATE,
+ TYPE_HVF_ACCEL)
#endif
diff --git a/include/sysemu/iothread.h b/include/sysemu/iothread.h
index 42902ffb9f..0c5284dbbc 100644
--- a/include/sysemu/iothread.h
+++ b/include/sysemu/iothread.h
@@ -40,8 +40,8 @@ struct IOThread {
};
typedef struct IOThread IOThread;
-#define IOTHREAD(obj) \
- OBJECT_CHECK(IOThread, obj, TYPE_IOTHREAD)
+DECLARE_INSTANCE_CHECKER(IOThread, IOTHREAD,
+ TYPE_IOTHREAD)
char *iothread_get_id(IOThread *iothread);
IOThread *iothread_by_id(const char *id);
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index 3e89884c54..5bbea53883 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -204,8 +204,8 @@ struct KVMState;
#define TYPE_KVM_ACCEL ACCEL_CLASS_NAME("kvm")
typedef struct KVMState KVMState;
-#define KVM_STATE(obj) \
- OBJECT_CHECK(KVMState, (obj), TYPE_KVM_ACCEL)
+DECLARE_INSTANCE_CHECKER(KVMState, KVM_STATE,
+ TYPE_KVM_ACCEL)
extern KVMState *kvm_state;
typedef struct Notifier Notifier;
diff --git a/include/sysemu/rng-random.h b/include/sysemu/rng-random.h
index 87e82dd7a3..58033ac3fe 100644
--- a/include/sysemu/rng-random.h
+++ b/include/sysemu/rng-random.h
@@ -16,7 +16,8 @@
#define TYPE_RNG_RANDOM "rng-random"
typedef struct RngRandom RngRandom;
-#define RNG_RANDOM(obj) OBJECT_CHECK(RngRandom, (obj), TYPE_RNG_RANDOM)
+DECLARE_INSTANCE_CHECKER(RngRandom, RNG_RANDOM,
+ TYPE_RNG_RANDOM)
#endif
diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h
index c38da7d342..f8fc948109 100644
--- a/include/sysemu/rng.h
+++ b/include/sysemu/rng.h
@@ -19,12 +19,8 @@
#define TYPE_RNG_BACKEND "rng-backend"
typedef struct RngBackend RngBackend;
typedef struct RngBackendClass RngBackendClass;
-#define RNG_BACKEND(obj) \
- OBJECT_CHECK(RngBackend, (obj), TYPE_RNG_BACKEND)
-#define RNG_BACKEND_GET_CLASS(obj) \
- OBJECT_GET_CLASS(RngBackendClass, (obj), TYPE_RNG_BACKEND)
-#define RNG_BACKEND_CLASS(klass) \
- OBJECT_CLASS_CHECK(RngBackendClass, (klass), TYPE_RNG_BACKEND)
+DECLARE_OBJ_CHECKERS(RngBackend, RngBackendClass,
+ RNG_BACKEND, TYPE_RNG_BACKEND)
#define TYPE_RNG_BUILTIN "rng-builtin"
diff --git a/include/sysemu/tpm.h b/include/sysemu/tpm.h
index 04673cab53..1a85564e47 100644
--- a/include/sysemu/tpm.h
+++ b/include/sysemu/tpm.h
@@ -27,10 +27,8 @@ typedef enum TPMVersion {
#define TYPE_TPM_IF "tpm-if"
typedef struct TPMIfClass TPMIfClass;
-#define TPM_IF_CLASS(klass) \
- OBJECT_CLASS_CHECK(TPMIfClass, (klass), TYPE_TPM_IF)
-#define TPM_IF_GET_CLASS(obj) \
- OBJECT_GET_CLASS(TPMIfClass, (obj), TYPE_TPM_IF)
+DECLARE_CLASS_CHECKERS(TPMIfClass, TPM_IF,
+ TYPE_TPM_IF)
#define TPM_IF(obj) \
INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF)
diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h
index 740c94c6cd..e038b79d34 100644
--- a/include/sysemu/tpm_backend.h
+++ b/include/sysemu/tpm_backend.h
@@ -21,12 +21,8 @@
#define TYPE_TPM_BACKEND "tpm-backend"
typedef struct TPMBackend TPMBackend;
typedef struct TPMBackendClass TPMBackendClass;
-#define TPM_BACKEND(obj) \
- OBJECT_CHECK(TPMBackend, (obj), TYPE_TPM_BACKEND)
-#define TPM_BACKEND_GET_CLASS(obj) \
- OBJECT_GET_CLASS(TPMBackendClass, (obj), TYPE_TPM_BACKEND)
-#define TPM_BACKEND_CLASS(klass) \
- OBJECT_CLASS_CHECK(TPMBackendClass, (klass), TYPE_TPM_BACKEND)
+DECLARE_OBJ_CHECKERS(TPMBackend, TPMBackendClass,
+ TPM_BACKEND, TYPE_TPM_BACKEND)
typedef struct TPMBackendCmd {
diff --git a/include/sysemu/vhost-user-backend.h b/include/sysemu/vhost-user-backend.h
index 89eb5eaf65..e4c85e33c0 100644
--- a/include/sysemu/vhost-user-backend.h
+++ b/include/sysemu/vhost-user-backend.h
@@ -24,12 +24,8 @@
#define TYPE_VHOST_USER_BACKEND "vhost-user-backend"
typedef struct VhostUserBackend VhostUserBackend;
typedef struct VhostUserBackendClass VhostUserBackendClass;
-#define VHOST_USER_BACKEND(obj) \
- OBJECT_CHECK(VhostUserBackend, (obj), TYPE_VHOST_USER_BACKEND)
-#define VHOST_USER_BACKEND_GET_CLASS(obj) \
- OBJECT_GET_CLASS(VhostUserBackendClass, (obj), TYPE_VHOST_USER_BACKEND)
-#define VHOST_USER_BACKEND_CLASS(klass) \
- OBJECT_CLASS_CHECK(VhostUserBackendClass, (klass), TYPE_VHOST_USER_BACKEND)
+DECLARE_OBJ_CHECKERS(VhostUserBackend, VhostUserBackendClass,
+ VHOST_USER_BACKEND, TYPE_VHOST_USER_BACKEND)
struct VhostUserBackendClass {
diff --git a/include/ui/console.h b/include/ui/console.h
index 2a74a27d50..8602203523 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -107,12 +107,8 @@ void kbd_put_keysym(int keysym);
#define TYPE_QEMU_CONSOLE "qemu-console"
typedef struct QemuConsoleClass QemuConsoleClass;
-#define QEMU_CONSOLE(obj) \
- OBJECT_CHECK(QemuConsole, (obj), TYPE_QEMU_CONSOLE)
-#define QEMU_CONSOLE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(QemuConsoleClass, (obj), TYPE_QEMU_CONSOLE)
-#define QEMU_CONSOLE_CLASS(klass) \
- OBJECT_CLASS_CHECK(QemuConsoleClass, (klass), TYPE_QEMU_CONSOLE)
+DECLARE_OBJ_CHECKERS(QemuConsole, QemuConsoleClass,
+ QEMU_CONSOLE, TYPE_QEMU_CONSOLE)
struct QemuConsoleClass {