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>
diff --git a/hw/audio/ac97.c b/hw/audio/ac97.c
index 9614419..eb8a7f0 100644
--- a/hw/audio/ac97.c
+++ b/hw/audio/ac97.c
@@ -128,8 +128,8 @@
#define TYPE_AC97 "AC97"
typedef struct AC97LinkState AC97LinkState;
-#define AC97(obj) \
- OBJECT_CHECK(AC97LinkState, (obj), TYPE_AC97)
+DECLARE_INSTANCE_CHECKER(AC97LinkState, AC97,
+ TYPE_AC97)
#define REC_MASK 7
enum {
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index a216fe1..870116e 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -53,7 +53,8 @@
#define TYPE_ADLIB "adlib"
typedef struct AdlibState AdlibState;
-#define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
+DECLARE_INSTANCE_CHECKER(AdlibState, ADLIB,
+ TYPE_ADLIB)
struct AdlibState {
ISADevice parent_obj;
diff --git a/hw/audio/cs4231.c b/hw/audio/cs4231.c
index 2b86805..8e9554c 100644
--- a/hw/audio/cs4231.c
+++ b/hw/audio/cs4231.c
@@ -39,8 +39,8 @@
#define TYPE_CS4231 "SUNW,CS4231"
typedef struct CSState CSState;
-#define CS4231(obj) \
- OBJECT_CHECK(CSState, (obj), TYPE_CS4231)
+DECLARE_INSTANCE_CHECKER(CSState, CS4231,
+ TYPE_CS4231)
struct CSState {
SysBusDevice parent_obj;
diff --git a/hw/audio/cs4231a.c b/hw/audio/cs4231a.c
index fc064a9..7d60ce6 100644
--- a/hw/audio/cs4231a.c
+++ b/hw/audio/cs4231a.c
@@ -64,7 +64,8 @@
#define TYPE_CS4231A "cs4231a"
typedef struct CSState CSState;
-#define CS4231A(obj) OBJECT_CHECK (CSState, (obj), TYPE_CS4231A)
+DECLARE_INSTANCE_CHECKER(CSState, CS4231A,
+ TYPE_CS4231A)
struct CSState {
ISADevice dev;
diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index bd620d5..a824f89 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -293,8 +293,8 @@
};
#define TYPE_ES1370 "ES1370"
-#define ES1370(obj) \
- OBJECT_CHECK(ES1370State, (obj), TYPE_ES1370)
+DECLARE_INSTANCE_CHECKER(ES1370State, ES1370,
+ TYPE_ES1370)
static void es1370_dac1_calc_freq (ES1370State *s, uint32_t ctl,
uint32_t *old_freq, uint32_t *new_freq);
diff --git a/hw/audio/gus.c b/hw/audio/gus.c
index 3cd62d4..307fd48 100644
--- a/hw/audio/gus.c
+++ b/hw/audio/gus.c
@@ -44,7 +44,8 @@
#define TYPE_GUS "gus"
typedef struct GUSState GUSState;
-#define GUS(obj) OBJECT_CHECK (GUSState, (obj), TYPE_GUS)
+DECLARE_INSTANCE_CHECKER(GUSState, GUS,
+ TYPE_GUS)
struct GUSState {
ISADevice dev;
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
index 8dee291..77d31b9 100644
--- a/hw/audio/hda-codec.c
+++ b/hw/audio/hda-codec.c
@@ -172,7 +172,8 @@
};
#define TYPE_HDA_AUDIO "hda-audio"
-#define HDA_AUDIO(obj) OBJECT_CHECK(HDAAudioState, (obj), TYPE_HDA_AUDIO)
+DECLARE_INSTANCE_CHECKER(HDAAudioState, HDA_AUDIO,
+ TYPE_HDA_AUDIO)
struct HDAAudioState {
HDACodecDevice hda;
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index de30443..4330213 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -204,8 +204,8 @@
#define TYPE_INTEL_HDA_GENERIC "intel-hda-generic"
-#define INTEL_HDA(obj) \
- OBJECT_CHECK(IntelHDAState, (obj), TYPE_INTEL_HDA_GENERIC)
+DECLARE_INSTANCE_CHECKER(IntelHDAState, INTEL_HDA,
+ TYPE_INTEL_HDA_GENERIC)
struct IntelHDAReg {
const char *name; /* register name */
diff --git a/hw/audio/intel-hda.h b/hw/audio/intel-hda.h
index 44a2897..813a7a3 100644
--- a/hw/audio/intel-hda.h
+++ b/hw/audio/intel-hda.h
@@ -10,16 +10,13 @@
#define TYPE_HDA_CODEC_DEVICE "hda-codec"
typedef struct HDACodecDevice HDACodecDevice;
typedef struct HDACodecDeviceClass HDACodecDeviceClass;
-#define HDA_CODEC_DEVICE(obj) \
- OBJECT_CHECK(HDACodecDevice, (obj), TYPE_HDA_CODEC_DEVICE)
-#define HDA_CODEC_DEVICE_CLASS(klass) \
- OBJECT_CLASS_CHECK(HDACodecDeviceClass, (klass), TYPE_HDA_CODEC_DEVICE)
-#define HDA_CODEC_DEVICE_GET_CLASS(obj) \
- OBJECT_GET_CLASS(HDACodecDeviceClass, (obj), TYPE_HDA_CODEC_DEVICE)
+DECLARE_OBJ_CHECKERS(HDACodecDevice, HDACodecDeviceClass,
+ HDA_CODEC_DEVICE, TYPE_HDA_CODEC_DEVICE)
#define TYPE_HDA_BUS "HDA"
typedef struct HDACodecBus HDACodecBus;
-#define HDA_BUS(obj) OBJECT_CHECK(HDACodecBus, (obj), TYPE_HDA_BUS)
+DECLARE_INSTANCE_CHECKER(HDACodecBus, HDA_BUS,
+ TYPE_HDA_BUS)
typedef void (*hda_codec_response_func)(HDACodecDevice *dev,
diff --git a/hw/audio/marvell_88w8618.c b/hw/audio/marvell_88w8618.c
index 5f2e7f3..c864156 100644
--- a/hw/audio/marvell_88w8618.c
+++ b/hw/audio/marvell_88w8618.c
@@ -44,8 +44,8 @@
#define MP_AUDIO_MONO (1 << 14)
typedef struct mv88w8618_audio_state mv88w8618_audio_state;
-#define MV88W8618_AUDIO(obj) \
- OBJECT_CHECK(mv88w8618_audio_state, (obj), TYPE_MV88W8618_AUDIO)
+DECLARE_INSTANCE_CHECKER(mv88w8618_audio_state, MV88W8618_AUDIO,
+ TYPE_MV88W8618_AUDIO)
struct mv88w8618_audio_state {
SysBusDevice parent_obj;
diff --git a/hw/audio/milkymist-ac97.c b/hw/audio/milkymist-ac97.c
index 4eacd40..7893539 100644
--- a/hw/audio/milkymist-ac97.c
+++ b/hw/audio/milkymist-ac97.c
@@ -57,8 +57,8 @@
#define TYPE_MILKYMIST_AC97 "milkymist-ac97"
typedef struct MilkymistAC97State MilkymistAC97State;
-#define MILKYMIST_AC97(obj) \
- OBJECT_CHECK(MilkymistAC97State, (obj), TYPE_MILKYMIST_AC97)
+DECLARE_INSTANCE_CHECKER(MilkymistAC97State, MILKYMIST_AC97,
+ TYPE_MILKYMIST_AC97)
struct MilkymistAC97State {
SysBusDevice parent_obj;
diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index 57edbe6..cbee885 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -41,7 +41,8 @@
#define PCSPK_MIN_COUNT DIV_ROUND_UP(PIT_FREQ, PCSPK_MAX_FREQ)
typedef struct PCSpkState PCSpkState;
-#define PC_SPEAKER(obj) OBJECT_CHECK(PCSpkState, (obj), TYPE_PC_SPEAKER)
+DECLARE_INSTANCE_CHECKER(PCSpkState, PC_SPEAKER,
+ TYPE_PC_SPEAKER)
struct PCSpkState {
ISADevice parent_obj;
diff --git a/hw/audio/pl041.c b/hw/audio/pl041.c
index e514a8c..570a234 100644
--- a/hw/audio/pl041.c
+++ b/hw/audio/pl041.c
@@ -79,7 +79,8 @@
#define TYPE_PL041 "pl041"
typedef struct PL041State PL041State;
-#define PL041(obj) OBJECT_CHECK(PL041State, (obj), TYPE_PL041)
+DECLARE_INSTANCE_CHECKER(PL041State, PL041,
+ TYPE_PL041)
struct PL041State {
SysBusDevice parent_obj;
diff --git a/hw/audio/sb16.c b/hw/audio/sb16.c
index 840f743..6aa2c0f 100644
--- a/hw/audio/sb16.c
+++ b/hw/audio/sb16.c
@@ -51,7 +51,8 @@
#define TYPE_SB16 "sb16"
typedef struct SB16State SB16State;
-#define SB16(obj) OBJECT_CHECK (SB16State, (obj), TYPE_SB16)
+DECLARE_INSTANCE_CHECKER(SB16State, SB16,
+ TYPE_SB16)
struct SB16State {
ISADevice parent_obj;
diff --git a/hw/audio/wm8750.c b/hw/audio/wm8750.c
index dae23f4..7d6fcfe 100644
--- a/hw/audio/wm8750.c
+++ b/hw/audio/wm8750.c
@@ -28,7 +28,8 @@
} WMRate;
typedef struct WM8750State WM8750State;
-#define WM8750(obj) OBJECT_CHECK(WM8750State, (obj), TYPE_WM8750)
+DECLARE_INSTANCE_CHECKER(WM8750State, WM8750,
+ TYPE_WM8750)
struct WM8750State {
I2CSlave parent_obj;