@@ -22,7 +22,7 @@ typedef struct AcpiDeviceIfClass AcpiDeviceIfClass;
DECLARE_CLASS_CHECKERS(AcpiDeviceIfClass, ACPI_DEVICE_IF,
TYPE_ACPI_DEVICE_IF)
#define ACPI_DEVICE_IF(obj) \
- INTERFACE_CHECK(AcpiDeviceIf, (obj), \
+ OBJECT_CHECK(AcpiDeviceIf, (obj), \
TYPE_ACPI_DEVICE_IF)
typedef struct AcpiDeviceIf AcpiDeviceIf;
@@ -13,7 +13,7 @@ typedef struct ARMLinuxBootIfClass ARMLinuxBootIfClass;
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)
+ OBJECT_CHECK(ARMLinuxBootIf, (obj), TYPE_ARM_LINUX_BOOT_IF)
typedef struct ARMLinuxBootIf ARMLinuxBootIf;
@@ -26,7 +26,7 @@ typedef struct FWPathProviderClass FWPathProviderClass;
DECLARE_CLASS_CHECKERS(FWPathProviderClass, FW_PATH_PROVIDER,
TYPE_FW_PATH_PROVIDER)
#define FW_PATH_PROVIDER(obj) \
- INTERFACE_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
+ OBJECT_CHECK(FWPathProvider, (obj), TYPE_FW_PATH_PROVIDER)
typedef struct FWPathProvider FWPathProvider;
@@ -20,7 +20,7 @@ typedef struct HotplugHandlerClass HotplugHandlerClass;
DECLARE_CLASS_CHECKERS(HotplugHandlerClass, HOTPLUG_HANDLER,
TYPE_HOTPLUG_HANDLER)
#define HOTPLUG_HANDLER(obj) \
- INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER)
+ OBJECT_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER)
typedef struct HotplugHandler HotplugHandler;
@@ -9,7 +9,7 @@ typedef struct InterruptStatsProviderClass InterruptStatsProviderClass;
DECLARE_CLASS_CHECKERS(InterruptStatsProviderClass, INTERRUPT_STATS_PROVIDER,
TYPE_INTERRUPT_STATS_PROVIDER)
#define INTERRUPT_STATS_PROVIDER(obj) \
- INTERFACE_CHECK(InterruptStatsProvider, (obj), \
+ OBJECT_CHECK(InterruptStatsProvider, (obj), \
TYPE_INTERRUPT_STATS_PROVIDER)
typedef struct InterruptStatsProvider InterruptStatsProvider;
@@ -110,7 +110,7 @@ uint32_t ipmi_next_uuid(void);
*/
#define TYPE_IPMI_INTERFACE "ipmi-interface"
#define IPMI_INTERFACE(obj) \
- INTERFACE_CHECK(IPMIInterface, (obj), TYPE_IPMI_INTERFACE)
+ OBJECT_CHECK(IPMIInterface, (obj), TYPE_IPMI_INTERFACE)
typedef struct IPMIInterfaceClass IPMIInterfaceClass;
DECLARE_CLASS_CHECKERS(IPMIInterfaceClass, IPMI_INTERFACE,
TYPE_IPMI_INTERFACE)
@@ -39,7 +39,7 @@ typedef struct IsaDmaClass IsaDmaClass;
DECLARE_CLASS_CHECKERS(IsaDmaClass, ISADMA,
TYPE_ISADMA)
#define ISADMA(obj) \
- INTERFACE_CHECK(IsaDma, (obj), TYPE_ISADMA)
+ OBJECT_CHECK(IsaDma, (obj), TYPE_ISADMA)
typedef enum {
ISADMA_TRANSFER_VERIFY,
@@ -23,7 +23,7 @@ typedef struct MemoryDeviceClass MemoryDeviceClass;
DECLARE_CLASS_CHECKERS(MemoryDeviceClass, MEMORY_DEVICE,
TYPE_MEMORY_DEVICE)
#define MEMORY_DEVICE(obj) \
- INTERFACE_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE)
+ OBJECT_CHECK(MemoryDeviceState, (obj), TYPE_MEMORY_DEVICE)
typedef struct MemoryDeviceState MemoryDeviceState;
@@ -30,7 +30,7 @@ typedef struct NMIClass NMIClass;
DECLARE_CLASS_CHECKERS(NMIClass, NMI,
TYPE_NMI)
#define NMI(obj) \
- INTERFACE_CHECK(NMIState, (obj), TYPE_NMI)
+ OBJECT_CHECK(NMIState, (obj), TYPE_NMI)
typedef struct NMIState NMIState;
@@ -26,7 +26,7 @@ typedef struct PnvXScomInterface PnvXScomInterface;
#define TYPE_PNV_XSCOM_INTERFACE "pnv-xscom-interface"
#define PNV_XSCOM_INTERFACE(obj) \
- INTERFACE_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
+ OBJECT_CHECK(PnvXScomInterface, (obj), TYPE_PNV_XSCOM_INTERFACE)
typedef struct PnvXScomInterfaceClass PnvXScomInterfaceClass;
DECLARE_CLASS_CHECKERS(PnvXScomInterfaceClass, PNV_XSCOM_INTERFACE,
TYPE_PNV_XSCOM_INTERFACE)
@@ -35,7 +35,7 @@ typedef struct SpaprInterruptController SpaprInterruptController;
#define TYPE_SPAPR_INTC "spapr-interrupt-controller"
#define SPAPR_INTC(obj) \
- INTERFACE_CHECK(SpaprInterruptController, (obj), TYPE_SPAPR_INTC)
+ OBJECT_CHECK(SpaprInterruptController, (obj), TYPE_SPAPR_INTC)
typedef struct SpaprInterruptControllerClass SpaprInterruptControllerClass;
DECLARE_CLASS_CHECKERS(SpaprInterruptControllerClass, SPAPR_INTC,
TYPE_SPAPR_INTC)
@@ -138,7 +138,7 @@ struct ICSIRQState {
#define TYPE_XICS_FABRIC "xics-fabric"
#define XICS_FABRIC(obj) \
- INTERFACE_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC)
+ OBJECT_CHECK(XICSFabric, (obj), TYPE_XICS_FABRIC)
typedef struct XICSFabricClass XICSFabricClass;
DECLARE_CLASS_CHECKERS(XICSFabricClass, XICS_FABRIC,
TYPE_XICS_FABRIC)
@@ -153,7 +153,7 @@ typedef struct XiveNotifier XiveNotifier;
#define TYPE_XIVE_NOTIFIER "xive-notifier"
#define XIVE_NOTIFIER(obj) \
- INTERFACE_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER)
+ OBJECT_CHECK(XiveNotifier, (obj), TYPE_XIVE_NOTIFIER)
typedef struct XiveNotifierClass XiveNotifierClass;
DECLARE_CLASS_CHECKERS(XiveNotifierClass, XIVE_NOTIFIER,
TYPE_XIVE_NOTIFIER)
@@ -390,7 +390,7 @@ typedef struct XiveTCTXMatch {
#define TYPE_XIVE_PRESENTER "xive-presenter"
#define XIVE_PRESENTER(obj) \
- INTERFACE_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER)
+ OBJECT_CHECK(XivePresenter, (obj), TYPE_XIVE_PRESENTER)
typedef struct XivePresenterClass XivePresenterClass;
DECLARE_CLASS_CHECKERS(XivePresenterClass, XIVE_PRESENTER,
TYPE_XIVE_PRESENTER)
@@ -415,7 +415,7 @@ int xive_presenter_tctx_match(XivePresenter *xptr, XiveTCTX *tctx,
#define TYPE_XIVE_FABRIC "xive-fabric"
#define XIVE_FABRIC(obj) \
- INTERFACE_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC)
+ OBJECT_CHECK(XiveFabric, (obj), TYPE_XIVE_FABRIC)
typedef struct XiveFabricClass XiveFabricClass;
DECLARE_CLASS_CHECKERS(XiveFabricClass, XIVE_FABRIC,
TYPE_XIVE_FABRIC)
@@ -23,7 +23,7 @@ typedef struct RdmaProviderClass RdmaProviderClass;
DECLARE_CLASS_CHECKERS(RdmaProviderClass, RDMA_PROVIDER,
INTERFACE_RDMA_PROVIDER)
#define RDMA_PROVIDER(obj) \
- INTERFACE_CHECK(RdmaProvider, (obj), \
+ OBJECT_CHECK(RdmaProvider, (obj), \
INTERFACE_RDMA_PROVIDER)
typedef struct RdmaProvider RdmaProvider;
@@ -35,7 +35,7 @@ typedef struct NvramClass NvramClass;
DECLARE_CLASS_CHECKERS(NvramClass, NVRAM,
TYPE_NVRAM)
#define NVRAM(obj) \
- INTERFACE_CHECK(Nvram, (obj), TYPE_NVRAM)
+ OBJECT_CHECK(Nvram, (obj), TYPE_NVRAM)
typedef struct Nvram Nvram;
@@ -10,7 +10,7 @@ typedef struct StreamSlaveClass StreamSlaveClass;
DECLARE_CLASS_CHECKERS(StreamSlaveClass, STREAM_SLAVE,
TYPE_STREAM_SLAVE)
#define STREAM_SLAVE(obj) \
- INTERFACE_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE)
+ OBJECT_CHECK(StreamSlave, (obj), TYPE_STREAM_SLAVE)
typedef struct StreamSlave StreamSlave;
@@ -17,7 +17,7 @@ typedef struct VMStateIfClass VMStateIfClass;
DECLARE_CLASS_CHECKERS(VMStateIfClass, VMSTATE_IF,
TYPE_VMSTATE_IF)
#define VMSTATE_IF(obj) \
- INTERFACE_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
+ OBJECT_CHECK(VMStateIf, (obj), TYPE_VMSTATE_IF)
typedef struct VMStateIf VMStateIf;
@@ -920,18 +920,6 @@ struct InterfaceClass
#define INTERFACE_CLASS(klass) \
OBJECT_CLASS_CHECK(InterfaceClass, klass, TYPE_INTERFACE)
-/**
- * INTERFACE_CHECK:
- * @interface: the type to return
- * @obj: the object to convert to an interface
- * @name: the interface type name
- *
- * Returns: @obj casted to @interface if cast is valid, otherwise raise error.
- */
-#define INTERFACE_CHECK(interface, obj, name) \
- ((interface *)object_dynamic_cast_assert(OBJECT((obj)), (name), \
- __FILE__, __LINE__, __func__))
-
/**
* object_new_with_class:
* @klass: The class to instantiate.
@@ -10,7 +10,7 @@ typedef struct UserCreatableClass UserCreatableClass;
DECLARE_CLASS_CHECKERS(UserCreatableClass, USER_CREATABLE,
TYPE_USER_CREATABLE)
#define USER_CREATABLE(obj) \
- INTERFACE_CHECK(UserCreatable, (obj), \
+ OBJECT_CHECK(UserCreatable, (obj), \
TYPE_USER_CREATABLE)
typedef struct UserCreatable UserCreatable;
@@ -30,7 +30,7 @@ typedef struct TPMIfClass TPMIfClass;
DECLARE_CLASS_CHECKERS(TPMIfClass, TPM_IF,
TYPE_TPM_IF)
#define TPM_IF(obj) \
- INTERFACE_CHECK(TPMIf, (obj), TYPE_TPM_IF)
+ OBJECT_CHECK(TPMIf, (obj), TYPE_TPM_IF)
typedef struct TPMIf TPMIf;
@@ -32,7 +32,7 @@
#define TYPE_IDAU_INTERFACE "idau-interface"
#define IDAU_INTERFACE(obj) \
- INTERFACE_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE)
+ OBJECT_CHECK(IDAUInterface, (obj), TYPE_IDAU_INTERFACE)
typedef struct IDAUInterfaceClass IDAUInterfaceClass;
DECLARE_CLASS_CHECKERS(IDAUInterfaceClass, IDAU_INTERFACE,
TYPE_IDAU_INTERFACE)
@@ -20,7 +20,7 @@ typedef struct TestIfClass TestIfClass;
DECLARE_CLASS_CHECKERS(TestIfClass, TEST_IF,
TYPE_TEST_IF)
#define TEST_IF(obj) \
- INTERFACE_CHECK(TestIf, (obj), TYPE_TEST_IF)
+ OBJECT_CHECK(TestIf, (obj), TYPE_TEST_IF)
typedef struct TestIf TestIf;
INTERFACE_CHECK and OBJECT_CHECK do exactly the same. There's no need to have two different methods for declaring the type checker macro for interface types. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Corey Minyard <minyard@acm.org> Cc: "Cédric Le Goater" <clg@kaod.org> Cc: David Gibson <david@gibson.dropbear.id.au> Cc: "Hervé Poussineau" <hpoussin@reactos.org> Cc: "Edgar E. Iglesias" <edgar.iglesias@gmail.com> Cc: Juan Quintela <quintela@redhat.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: "Daniel P. Berrangé" <berrange@redhat.com> Cc: Eduardo Habkost <ehabkost@redhat.com> Cc: Stefan Berger <stefanb@linux.ibm.com> Cc: Peter Maydell <peter.maydell@linaro.org> Cc: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org Cc: qemu-arm@nongnu.org --- include/hw/acpi/acpi_dev_interface.h | 2 +- include/hw/arm/linux-boot-if.h | 2 +- include/hw/fw-path-provider.h | 2 +- include/hw/hotplug.h | 2 +- include/hw/intc/intc.h | 2 +- include/hw/ipmi/ipmi.h | 2 +- include/hw/isa/isa.h | 2 +- include/hw/mem/memory-device.h | 2 +- include/hw/nmi.h | 2 +- include/hw/ppc/pnv_xscom.h | 2 +- include/hw/ppc/spapr_irq.h | 2 +- include/hw/ppc/xics.h | 2 +- include/hw/ppc/xive.h | 6 +++--- include/hw/rdma/rdma.h | 2 +- include/hw/rtc/m48t59.h | 2 +- include/hw/stream.h | 2 +- include/hw/vmstate-if.h | 2 +- include/qom/object.h | 12 ------------ include/qom/object_interfaces.h | 2 +- include/sysemu/tpm.h | 2 +- target/arm/idau.h | 2 +- tests/check-qom-interface.c | 2 +- 22 files changed, 23 insertions(+), 35 deletions(-)