From db1015e92e04835c9eb50c29625fe566d1202dbd Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Thu, 3 Sep 2020 16:43:22 -0400 Subject: Move QOM typedefs and add missing includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some typedefs and macros are defined after the type check macros. This makes it difficult to automatically replace their definitions with OBJECT_DECLARE_TYPE. Patch generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]') which will split "typdef struct { ... } TypedefName" declarations. Followed by: $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \ $(git grep -l '' -- '*.[ch]') which will: - move the typedefs and #defines above the type check macros - add missing #include "qom/object.h" lines if necessary Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Message-Id: <20200831210740.126168-9-ehabkost@redhat.com> Reviewed-by: Juan Quintela Message-Id: <20200831210740.126168-10-ehabkost@redhat.com> Message-Id: <20200831210740.126168-11-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- hw/timer/altera_timer.c | 6 ++++-- hw/timer/arm_timer.c | 11 +++++++---- hw/timer/cadence_ttc.c | 6 ++++-- hw/timer/etraxfs_timer.c | 6 ++++-- hw/timer/exynos4210_mct.c | 6 ++++-- hw/timer/exynos4210_pwm.c | 6 ++++-- hw/timer/grlib_gptimer.c | 3 ++- hw/timer/hpet.c | 6 ++++-- hw/timer/i8254.c | 6 ++++-- hw/timer/lm32_timer.c | 3 ++- hw/timer/milkymist-sysctl.c | 3 ++- hw/timer/puv3_ost.c | 6 ++++-- hw/timer/pxa2xx_timer.c | 3 ++- hw/timer/slavio_timer.c | 6 ++++-- hw/timer/xilinx_timer.c | 1 + 15 files changed, 52 insertions(+), 26 deletions(-) (limited to 'hw/timer') diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c index be81b7a..93bd5b9 100644 --- a/hw/timer/altera_timer.c +++ b/hw/timer/altera_timer.c @@ -26,6 +26,7 @@ #include "hw/irq.h" #include "hw/ptimer.h" #include "hw/qdev-properties.h" +#include "qom/object.h" #define R_STATUS 0 #define R_CONTROL 1 @@ -44,17 +45,18 @@ #define CONTROL_STOP 0x0008 #define TYPE_ALTERA_TIMER "ALTR.timer" +typedef struct AlteraTimer AlteraTimer; #define ALTERA_TIMER(obj) \ OBJECT_CHECK(AlteraTimer, (obj), TYPE_ALTERA_TIMER) -typedef struct AlteraTimer { +struct AlteraTimer { SysBusDevice busdev; MemoryRegion mmio; qemu_irq irq; uint32_t freq_hz; ptimer_state *ptimer; uint32_t regs[R_MAX]; -} AlteraTimer; +}; static int timer_irq_state(AlteraTimer *t) { diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index 9607366..d728a80 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -16,6 +16,7 @@ #include "hw/qdev-properties.h" #include "qemu/module.h" #include "qemu/log.h" +#include "qom/object.h" /* Common timer implementation. */ @@ -190,9 +191,10 @@ static arm_timer_state *arm_timer_init(uint32_t freq) */ #define TYPE_SP804 "sp804" +typedef struct SP804State SP804State; #define SP804(obj) OBJECT_CHECK(SP804State, (obj), TYPE_SP804) -typedef struct SP804State { +struct SP804State { SysBusDevice parent_obj; MemoryRegion iomem; @@ -200,7 +202,7 @@ typedef struct SP804State { uint32_t freq0, freq1; int level[2]; qemu_irq irq; -} SP804State; +}; static const uint8_t sp804_ids[] = { /* Timer ID */ @@ -310,15 +312,16 @@ static void sp804_realize(DeviceState *dev, Error **errp) /* Integrator/CP timer module. */ #define TYPE_INTEGRATOR_PIT "integrator_pit" +typedef struct icp_pit_state icp_pit_state; #define INTEGRATOR_PIT(obj) \ OBJECT_CHECK(icp_pit_state, (obj), TYPE_INTEGRATOR_PIT) -typedef struct { +struct icp_pit_state { SysBusDevice parent_obj; MemoryRegion iomem; arm_timer_state *timer[3]; -} icp_pit_state; +}; static uint64_t icp_pit_read(void *opaque, hwaddr offset, unsigned size) diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index b0ba6b2..24de679 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -22,6 +22,7 @@ #include "migration/vmstate.h" #include "qemu/module.h" #include "qemu/timer.h" +#include "qom/object.h" #ifdef CADENCE_TTC_ERR_DEBUG #define DB_PRINT(...) do { \ @@ -69,15 +70,16 @@ typedef struct { } CadenceTimerState; #define TYPE_CADENCE_TTC "cadence_ttc" +typedef struct CadenceTTCState CadenceTTCState; #define CADENCE_TTC(obj) \ OBJECT_CHECK(CadenceTTCState, (obj), TYPE_CADENCE_TTC) -typedef struct CadenceTTCState { +struct CadenceTTCState { SysBusDevice parent_obj; MemoryRegion iomem; CadenceTimerState timer[3]; -} CadenceTTCState; +}; static void cadence_timer_update(CadenceTimerState *s) { diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index afe3d30..92b8999 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -30,6 +30,7 @@ #include "qemu/timer.h" #include "hw/irq.h" #include "hw/ptimer.h" +#include "qom/object.h" #define D(x) @@ -48,10 +49,11 @@ #define R_MASKED_INTR 0x54 #define TYPE_ETRAX_FS_TIMER "etraxfs,timer" +typedef struct ETRAXTimerState ETRAXTimerState; #define ETRAX_TIMER(obj) \ OBJECT_CHECK(ETRAXTimerState, (obj), TYPE_ETRAX_FS_TIMER) -typedef struct ETRAXTimerState { +struct ETRAXTimerState { SysBusDevice parent_obj; MemoryRegion mmio; @@ -79,7 +81,7 @@ typedef struct ETRAXTimerState { uint32_t rw_ack_intr; uint32_t r_intr; uint32_t r_masked_intr; -} ETRAXTimerState; +}; static uint64_t timer_read(void *opaque, hwaddr addr, unsigned int size) diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index 29a4b10..aa8753d 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -62,6 +62,7 @@ #include "hw/arm/exynos4210.h" #include "hw/irq.h" +#include "qom/object.h" //#define DEBUG_MCT @@ -242,10 +243,11 @@ typedef struct { } Exynos4210MCTLT; #define TYPE_EXYNOS4210_MCT "exynos4210.mct" +typedef struct Exynos4210MCTState Exynos4210MCTState; #define EXYNOS4210_MCT(obj) \ OBJECT_CHECK(Exynos4210MCTState, (obj), TYPE_EXYNOS4210_MCT) -typedef struct Exynos4210MCTState { +struct Exynos4210MCTState { SysBusDevice parent_obj; MemoryRegion iomem; @@ -257,7 +259,7 @@ typedef struct Exynos4210MCTState { Exynos4210MCTGT g_timer; uint32_t freq; /* all timers tick frequency, TCLK */ -} Exynos4210MCTState; +}; /*** VMState ***/ static const VMStateDescription vmstate_tick_timer = { diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index 59a8c08..3422402 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -30,6 +30,7 @@ #include "hw/arm/exynos4210.h" #include "hw/irq.h" +#include "qom/object.h" //#define DEBUG_PWM @@ -102,10 +103,11 @@ typedef struct { } Exynos4210PWM; #define TYPE_EXYNOS4210_PWM "exynos4210.pwm" +typedef struct Exynos4210PWMState Exynos4210PWMState; #define EXYNOS4210_PWM(obj) \ OBJECT_CHECK(Exynos4210PWMState, (obj), TYPE_EXYNOS4210_PWM) -typedef struct Exynos4210PWMState { +struct Exynos4210PWMState { SysBusDevice parent_obj; MemoryRegion iomem; @@ -116,7 +118,7 @@ typedef struct Exynos4210PWMState { Exynos4210PWM timer[EXYNOS4210_PWM_TIMERS_NUM]; -} Exynos4210PWMState; +}; /*** VMState ***/ static const VMStateDescription vmstate_exynos4210_pwm = { diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index eff0ee3..91d4283 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -32,6 +32,7 @@ #include "qemu/module.h" #include "trace.h" +#include "qom/object.h" #define UNIT_REG_SIZE 16 /* Size of memory mapped regs for the unit */ #define GPTIMER_REG_SIZE 16 /* Size of memory mapped regs for a GPTimer */ @@ -55,11 +56,11 @@ #define COUNTER_RELOAD_OFFSET 0x04 #define TIMER_BASE 0x10 +typedef struct GPTimerUnit GPTimerUnit; #define GRLIB_GPTIMER(obj) \ OBJECT_CHECK(GPTimerUnit, (obj), TYPE_GRLIB_GPTIMER) typedef struct GPTimer GPTimer; -typedef struct GPTimerUnit GPTimerUnit; struct GPTimer { struct ptimer_state *ptimer; diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 380acfa..07b3c0f 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -37,6 +37,7 @@ #include "migration/vmstate.h" #include "hw/timer/i8254.h" #include "exec/address-spaces.h" +#include "qom/object.h" //#define HPET_DEBUG #ifdef HPET_DEBUG @@ -47,6 +48,7 @@ #define HPET_MSI_SUPPORT 0 +typedef struct HPETState HPETState; #define HPET(obj) OBJECT_CHECK(HPETState, (obj), TYPE_HPET) struct HPETState; @@ -65,7 +67,7 @@ typedef struct HPETTimer { /* timers */ */ } HPETTimer; -typedef struct HPETState { +struct HPETState { /*< private >*/ SysBusDevice parent_obj; /*< public >*/ @@ -87,7 +89,7 @@ typedef struct HPETState { uint64_t isr; /* interrupt status reg */ uint64_t hpet_counter; /* main counter */ uint8_t hpet_id; /* instance id */ -} HPETState; +}; static uint32_t hpet_in_legacy_mode(HPETState *s) { diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c index 29f62e5..54639d1 100644 --- a/hw/timer/i8254.c +++ b/hw/timer/i8254.c @@ -28,6 +28,7 @@ #include "qemu/timer.h" #include "hw/timer/i8254.h" #include "hw/timer/i8254_internal.h" +#include "qom/object.h" //#define DEBUG_PIT @@ -36,14 +37,15 @@ #define RW_STATE_WORD0 3 #define RW_STATE_WORD1 4 +typedef struct PITClass PITClass; #define PIT_CLASS(class) OBJECT_CLASS_CHECK(PITClass, (class), TYPE_I8254) #define PIT_GET_CLASS(obj) OBJECT_GET_CLASS(PITClass, (obj), TYPE_I8254) -typedef struct PITClass { +struct PITClass { PITCommonClass parent_class; DeviceRealize parent_realize; -} PITClass; +}; static void pit_irq_timer_update(PITChannelState *s, int64_t current_time); diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c index f703f40..807ceb5 100644 --- a/hw/timer/lm32_timer.c +++ b/hw/timer/lm32_timer.c @@ -31,6 +31,7 @@ #include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "qom/object.h" #define DEFAULT_FREQUENCY (50*1000000) @@ -55,6 +56,7 @@ enum { }; #define TYPE_LM32_TIMER "lm32-timer" +typedef struct LM32TimerState LM32TimerState; #define LM32_TIMER(obj) OBJECT_CHECK(LM32TimerState, (obj), TYPE_LM32_TIMER) struct LM32TimerState { @@ -69,7 +71,6 @@ struct LM32TimerState { uint32_t regs[R_MAX]; }; -typedef struct LM32TimerState LM32TimerState; static void timer_update_irq(LM32TimerState *s) { diff --git a/hw/timer/milkymist-sysctl.c b/hw/timer/milkymist-sysctl.c index 9438982..3667a09 100644 --- a/hw/timer/milkymist-sysctl.c +++ b/hw/timer/milkymist-sysctl.c @@ -32,6 +32,7 @@ #include "hw/qdev-properties.h" #include "qemu/error-report.h" #include "qemu/module.h" +#include "qom/object.h" enum { CTRL_ENABLE = (1<<0), @@ -62,6 +63,7 @@ enum { }; #define TYPE_MILKYMIST_SYSCTL "milkymist-sysctl" +typedef struct MilkymistSysctlState MilkymistSysctlState; #define MILKYMIST_SYSCTL(obj) \ OBJECT_CHECK(MilkymistSysctlState, (obj), TYPE_MILKYMIST_SYSCTL) @@ -84,7 +86,6 @@ struct MilkymistSysctlState { qemu_irq timer0_irq; qemu_irq timer1_irq; }; -typedef struct MilkymistSysctlState MilkymistSysctlState; static void sysctl_icap_write(MilkymistSysctlState *s, uint32_t value) { diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c index f76b0bb..8d61c67 100644 --- a/hw/timer/puv3_ost.c +++ b/hw/timer/puv3_ost.c @@ -15,15 +15,17 @@ #include "hw/ptimer.h" #include "qemu/module.h" #include "qemu/log.h" +#include "qom/object.h" #undef DEBUG_PUV3 #include "hw/unicore32/puv3.h" #define TYPE_PUV3_OST "puv3_ost" +typedef struct PUV3OSTState PUV3OSTState; #define PUV3_OST(obj) OBJECT_CHECK(PUV3OSTState, (obj), TYPE_PUV3_OST) /* puv3 ostimer implementation. */ -typedef struct PUV3OSTState { +struct PUV3OSTState { SysBusDevice parent_obj; MemoryRegion iomem; @@ -34,7 +36,7 @@ typedef struct PUV3OSTState { uint32_t reg_OSCR; uint32_t reg_OSSR; uint32_t reg_OIER; -} PUV3OSTState; +}; static uint64_t puv3_ost_read(void *opaque, hwaddr offset, unsigned size) diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c index 944c165..c73cc72 100644 --- a/hw/timer/pxa2xx_timer.c +++ b/hw/timer/pxa2xx_timer.c @@ -17,6 +17,7 @@ #include "migration/vmstate.h" #include "qemu/log.h" #include "qemu/module.h" +#include "qom/object.h" #define OSMR0 0x00 #define OSMR1 0x04 @@ -66,10 +67,10 @@ static int pxa2xx_timer4_freq[8] = { }; #define TYPE_PXA2XX_TIMER "pxa2xx-timer" +typedef struct PXA2xxTimerInfo PXA2xxTimerInfo; #define PXA2XX_TIMER(obj) \ OBJECT_CHECK(PXA2xxTimerInfo, (obj), TYPE_PXA2XX_TIMER) -typedef struct PXA2xxTimerInfo PXA2xxTimerInfo; typedef struct { uint32_t value; diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c index 4c5d65e..28d6123 100644 --- a/hw/timer/slavio_timer.c +++ b/hw/timer/slavio_timer.c @@ -31,6 +31,7 @@ #include "migration/vmstate.h" #include "trace.h" #include "qemu/module.h" +#include "qom/object.h" /* * Registers of hardware timer in sun4m. @@ -59,16 +60,17 @@ typedef struct CPUTimerState { } CPUTimerState; #define TYPE_SLAVIO_TIMER "slavio_timer" +typedef struct SLAVIO_TIMERState SLAVIO_TIMERState; #define SLAVIO_TIMER(obj) \ OBJECT_CHECK(SLAVIO_TIMERState, (obj), TYPE_SLAVIO_TIMER) -typedef struct SLAVIO_TIMERState { +struct SLAVIO_TIMERState { SysBusDevice parent_obj; uint32_t num_cpus; uint32_t cputimer_mode; CPUTimerState cputimer[MAX_CPUS + 1]; -} SLAVIO_TIMERState; +}; typedef struct TimerContext { MemoryRegion iomem; diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index 0190aa4..c262f6d 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -29,6 +29,7 @@ #include "hw/qdev-properties.h" #include "qemu/log.h" #include "qemu/module.h" +#include "qom/object.h" #define D(x) -- cgit v1.1 From 8110fa1d94f2997badc2af39231a1d279c5bb1ee Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Mon, 31 Aug 2020 17:07:33 -0400 Subject: Use DECLARE_*CHECKER* macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generated using: $ ./scripts/codeconverter/converter.py -i \ --pattern=TypeCheckMacro $(git grep -l '' -- '*.[ch]') Reviewed-by: Daniel P. Berrangé Reviewed-by: Juan Quintela Message-Id: <20200831210740.126168-12-ehabkost@redhat.com> Reviewed-by: Juan Quintela Message-Id: <20200831210740.126168-13-ehabkost@redhat.com> Message-Id: <20200831210740.126168-14-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- hw/timer/altera_timer.c | 4 ++-- hw/timer/arm_timer.c | 7 ++++--- hw/timer/cadence_ttc.c | 4 ++-- hw/timer/etraxfs_timer.c | 4 ++-- hw/timer/exynos4210_mct.c | 4 ++-- hw/timer/exynos4210_pwm.c | 4 ++-- hw/timer/grlib_gptimer.c | 4 ++-- hw/timer/hpet.c | 3 ++- hw/timer/i8254.c | 4 ++-- hw/timer/lm32_timer.c | 3 ++- hw/timer/milkymist-sysctl.c | 4 ++-- hw/timer/puv3_ost.c | 3 ++- hw/timer/pxa2xx_timer.c | 4 ++-- hw/timer/slavio_timer.c | 4 ++-- hw/timer/xilinx_timer.c | 4 ++-- 15 files changed, 32 insertions(+), 28 deletions(-) (limited to 'hw/timer') diff --git a/hw/timer/altera_timer.c b/hw/timer/altera_timer.c index 93bd5b9..c694c98 100644 --- a/hw/timer/altera_timer.c +++ b/hw/timer/altera_timer.c @@ -46,8 +46,8 @@ #define TYPE_ALTERA_TIMER "ALTR.timer" typedef struct AlteraTimer AlteraTimer; -#define ALTERA_TIMER(obj) \ - OBJECT_CHECK(AlteraTimer, (obj), TYPE_ALTERA_TIMER) +DECLARE_INSTANCE_CHECKER(AlteraTimer, ALTERA_TIMER, + TYPE_ALTERA_TIMER) struct AlteraTimer { SysBusDevice busdev; diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c index d728a80..79117f4 100644 --- a/hw/timer/arm_timer.c +++ b/hw/timer/arm_timer.c @@ -192,7 +192,8 @@ static arm_timer_state *arm_timer_init(uint32_t freq) #define TYPE_SP804 "sp804" typedef struct SP804State SP804State; -#define SP804(obj) OBJECT_CHECK(SP804State, (obj), TYPE_SP804) +DECLARE_INSTANCE_CHECKER(SP804State, SP804, + TYPE_SP804) struct SP804State { SysBusDevice parent_obj; @@ -313,8 +314,8 @@ static void sp804_realize(DeviceState *dev, Error **errp) #define TYPE_INTEGRATOR_PIT "integrator_pit" typedef struct icp_pit_state icp_pit_state; -#define INTEGRATOR_PIT(obj) \ - OBJECT_CHECK(icp_pit_state, (obj), TYPE_INTEGRATOR_PIT) +DECLARE_INSTANCE_CHECKER(icp_pit_state, INTEGRATOR_PIT, + TYPE_INTEGRATOR_PIT) struct icp_pit_state { SysBusDevice parent_obj; diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c index 24de679..52e6375 100644 --- a/hw/timer/cadence_ttc.c +++ b/hw/timer/cadence_ttc.c @@ -71,8 +71,8 @@ typedef struct { #define TYPE_CADENCE_TTC "cadence_ttc" typedef struct CadenceTTCState CadenceTTCState; -#define CADENCE_TTC(obj) \ - OBJECT_CHECK(CadenceTTCState, (obj), TYPE_CADENCE_TTC) +DECLARE_INSTANCE_CHECKER(CadenceTTCState, CADENCE_TTC, + TYPE_CADENCE_TTC) struct CadenceTTCState { SysBusDevice parent_obj; diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c index 92b8999..48f2e3a 100644 --- a/hw/timer/etraxfs_timer.c +++ b/hw/timer/etraxfs_timer.c @@ -50,8 +50,8 @@ #define TYPE_ETRAX_FS_TIMER "etraxfs,timer" typedef struct ETRAXTimerState ETRAXTimerState; -#define ETRAX_TIMER(obj) \ - OBJECT_CHECK(ETRAXTimerState, (obj), TYPE_ETRAX_FS_TIMER) +DECLARE_INSTANCE_CHECKER(ETRAXTimerState, ETRAX_TIMER, + TYPE_ETRAX_FS_TIMER) struct ETRAXTimerState { SysBusDevice parent_obj; diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c index aa8753d..0329cae 100644 --- a/hw/timer/exynos4210_mct.c +++ b/hw/timer/exynos4210_mct.c @@ -244,8 +244,8 @@ typedef struct { #define TYPE_EXYNOS4210_MCT "exynos4210.mct" typedef struct Exynos4210MCTState Exynos4210MCTState; -#define EXYNOS4210_MCT(obj) \ - OBJECT_CHECK(Exynos4210MCTState, (obj), TYPE_EXYNOS4210_MCT) +DECLARE_INSTANCE_CHECKER(Exynos4210MCTState, EXYNOS4210_MCT, + TYPE_EXYNOS4210_MCT) struct Exynos4210MCTState { SysBusDevice parent_obj; diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c index 3422402..5340fc0 100644 --- a/hw/timer/exynos4210_pwm.c +++ b/hw/timer/exynos4210_pwm.c @@ -104,8 +104,8 @@ typedef struct { #define TYPE_EXYNOS4210_PWM "exynos4210.pwm" typedef struct Exynos4210PWMState Exynos4210PWMState; -#define EXYNOS4210_PWM(obj) \ - OBJECT_CHECK(Exynos4210PWMState, (obj), TYPE_EXYNOS4210_PWM) +DECLARE_INSTANCE_CHECKER(Exynos4210PWMState, EXYNOS4210_PWM, + TYPE_EXYNOS4210_PWM) struct Exynos4210PWMState { SysBusDevice parent_obj; diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c index 91d4283..e539fc2 100644 --- a/hw/timer/grlib_gptimer.c +++ b/hw/timer/grlib_gptimer.c @@ -57,8 +57,8 @@ #define TIMER_BASE 0x10 typedef struct GPTimerUnit GPTimerUnit; -#define GRLIB_GPTIMER(obj) \ - OBJECT_CHECK(GPTimerUnit, (obj), TYPE_GRLIB_GPTIMER) +DECLARE_INSTANCE_CHECKER(GPTimerUnit, GRLIB_GPTIMER, + TYPE_GRLIB_GPTIMER) typedef struct GPTimer GPTimer; diff --git a/hw/timer/hpet.c b/hw/timer/hpet.c index 07b3c0f..44bbe3a 100644 --- a/hw/timer/hpet.c +++ b/hw/timer/hpet.c @@ -49,7 +49,8 @@ #define HPET_MSI_SUPPORT 0 typedef struct HPETState HPETState; -#define HPET(obj) OBJECT_CHECK(HPETState, (obj), TYPE_HPET) +DECLARE_INSTANCE_CHECKER(HPETState, HPET, + TYPE_HPET) struct HPETState; typedef struct HPETTimer { /* timers */ diff --git a/hw/timer/i8254.c b/hw/timer/i8254.c index 54639d1..c01ee2c 100644 --- a/hw/timer/i8254.c +++ b/hw/timer/i8254.c @@ -38,8 +38,8 @@ #define RW_STATE_WORD1 4 typedef struct PITClass PITClass; -#define PIT_CLASS(class) OBJECT_CLASS_CHECK(PITClass, (class), TYPE_I8254) -#define PIT_GET_CLASS(obj) OBJECT_GET_CLASS(PITClass, (obj), TYPE_I8254) +DECLARE_CLASS_CHECKERS(PITClass, PIT, + TYPE_I8254) struct PITClass { PITCommonClass parent_class; diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c index 807ceb5..93ecb51 100644 --- a/hw/timer/lm32_timer.c +++ b/hw/timer/lm32_timer.c @@ -57,7 +57,8 @@ enum { #define TYPE_LM32_TIMER "lm32-timer" typedef struct LM32TimerState LM32TimerState; -#define LM32_TIMER(obj) OBJECT_CHECK(LM32TimerState, (obj), TYPE_LM32_TIMER) +DECLARE_INSTANCE_CHECKER(LM32TimerState, LM32_TIMER, + TYPE_LM32_TIMER) struct LM32TimerState { SysBusDevice parent_obj; diff --git a/hw/timer/milkymist-sysctl.c b/hw/timer/milkymist-sysctl.c index 3667a09..29500e0 100644 --- a/hw/timer/milkymist-sysctl.c +++ b/hw/timer/milkymist-sysctl.c @@ -64,8 +64,8 @@ enum { #define TYPE_MILKYMIST_SYSCTL "milkymist-sysctl" typedef struct MilkymistSysctlState MilkymistSysctlState; -#define MILKYMIST_SYSCTL(obj) \ - OBJECT_CHECK(MilkymistSysctlState, (obj), TYPE_MILKYMIST_SYSCTL) +DECLARE_INSTANCE_CHECKER(MilkymistSysctlState, MILKYMIST_SYSCTL, + TYPE_MILKYMIST_SYSCTL) struct MilkymistSysctlState { SysBusDevice parent_obj; diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c index 8d61c67..3a35ac2 100644 --- a/hw/timer/puv3_ost.c +++ b/hw/timer/puv3_ost.c @@ -22,7 +22,8 @@ #define TYPE_PUV3_OST "puv3_ost" typedef struct PUV3OSTState PUV3OSTState; -#define PUV3_OST(obj) OBJECT_CHECK(PUV3OSTState, (obj), TYPE_PUV3_OST) +DECLARE_INSTANCE_CHECKER(PUV3OSTState, PUV3_OST, + TYPE_PUV3_OST) /* puv3 ostimer implementation. */ struct PUV3OSTState { diff --git a/hw/timer/pxa2xx_timer.c b/hw/timer/pxa2xx_timer.c index c73cc72..8c3a1f5 100644 --- a/hw/timer/pxa2xx_timer.c +++ b/hw/timer/pxa2xx_timer.c @@ -68,8 +68,8 @@ static int pxa2xx_timer4_freq[8] = { #define TYPE_PXA2XX_TIMER "pxa2xx-timer" typedef struct PXA2xxTimerInfo PXA2xxTimerInfo; -#define PXA2XX_TIMER(obj) \ - OBJECT_CHECK(PXA2xxTimerInfo, (obj), TYPE_PXA2XX_TIMER) +DECLARE_INSTANCE_CHECKER(PXA2xxTimerInfo, PXA2XX_TIMER, + TYPE_PXA2XX_TIMER) typedef struct { diff --git a/hw/timer/slavio_timer.c b/hw/timer/slavio_timer.c index 28d6123..08d6888 100644 --- a/hw/timer/slavio_timer.c +++ b/hw/timer/slavio_timer.c @@ -61,8 +61,8 @@ typedef struct CPUTimerState { #define TYPE_SLAVIO_TIMER "slavio_timer" typedef struct SLAVIO_TIMERState SLAVIO_TIMERState; -#define SLAVIO_TIMER(obj) \ - OBJECT_CHECK(SLAVIO_TIMERState, (obj), TYPE_SLAVIO_TIMER) +DECLARE_INSTANCE_CHECKER(SLAVIO_TIMERState, SLAVIO_TIMER, + TYPE_SLAVIO_TIMER) struct SLAVIO_TIMERState { SysBusDevice parent_obj; diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c index c262f6d..1eb927e 100644 --- a/hw/timer/xilinx_timer.c +++ b/hw/timer/xilinx_timer.c @@ -62,8 +62,8 @@ struct xlx_timer }; #define TYPE_XILINX_TIMER "xlnx.xps-timer" -#define XILINX_TIMER(obj) \ - OBJECT_CHECK(struct timerblock, (obj), TYPE_XILINX_TIMER) +DECLARE_INSTANCE_CHECKER(struct timerblock, XILINX_TIMER, + TYPE_XILINX_TIMER) struct timerblock { -- cgit v1.1