From 30b5707c269cac1ad80b72f777e52c8e08b2ff19 Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Wed, 16 Sep 2020 14:25:17 -0400 Subject: qom: Remove module_obj_name parameter from OBJECT_DECLARE* macros MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One of the goals of having less boilerplate on QOM declarations is to avoid human error. Requiring an extra argument that is never used is an opportunity for mistakes. Remove the unused argument from OBJECT_DECLARE_TYPE and OBJECT_DECLARE_SIMPLE_TYPE. Coccinelle patch used to convert all users of the macros: @@ declarer name OBJECT_DECLARE_TYPE; identifier InstanceType, ClassType, lowercase, UPPERCASE; @@ OBJECT_DECLARE_TYPE(InstanceType, ClassType, - lowercase, UPPERCASE); @@ declarer name OBJECT_DECLARE_SIMPLE_TYPE; identifier InstanceType, lowercase, UPPERCASE; @@ OBJECT_DECLARE_SIMPLE_TYPE(InstanceType, - lowercase, UPPERCASE); Signed-off-by: Eduardo Habkost Reviewed-by: Cédric Le Goater Acked-by: Cornelia Huck Acked-by: Igor Mammedov Acked-by: Paul Durrant Acked-by: Thomas Huth Message-Id: <20200916182519.415636-4-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- hw/display/virtio-vga.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/display') diff --git a/hw/display/virtio-vga.h b/hw/display/virtio-vga.h index 5c5671c..977ad5e 100644 --- a/hw/display/virtio-vga.h +++ b/hw/display/virtio-vga.h @@ -10,7 +10,7 @@ */ #define TYPE_VIRTIO_VGA_BASE "virtio-vga-base" OBJECT_DECLARE_TYPE(VirtIOVGABase, VirtIOVGABaseClass, - virtio_vga_base, VIRTIO_VGA_BASE) + VIRTIO_VGA_BASE) struct VirtIOVGABase { VirtIOPCIProxy parent_obj; -- cgit v1.1 From 8063396bf3459a810d24e3efd6110b8480f0de5b Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Wed, 16 Sep 2020 14:25:19 -0400 Subject: Use OBJECT_DECLARE_SIMPLE_TYPE when possible This converts existing DECLARE_INSTANCE_CHECKER usage to OBJECT_DECLARE_SIMPLE_TYPE when possible. $ ./scripts/codeconverter/converter.py -i \ --pattern=AddObjectDeclareSimpleType $(git grep -l '' -- '*.[ch]') Signed-off-by: Eduardo Habkost Acked-by: Paul Durrant Message-Id: <20200916182519.415636-6-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost --- hw/display/ads7846.c | 4 +--- hw/display/artist.c | 4 +--- hw/display/ati_int.h | 4 +--- hw/display/bochs-display.c | 4 +--- hw/display/cg3.c | 4 +--- hw/display/cirrus_vga.c | 4 +--- hw/display/cirrus_vga_isa.c | 4 +--- hw/display/exynos4210_fimd.c | 4 +--- hw/display/g364fb.c | 4 +--- hw/display/jazz_led.c | 4 +--- hw/display/milkymist-tmu2.c | 4 +--- hw/display/milkymist-vgafb.c | 4 +--- hw/display/next-fb.c | 4 +--- hw/display/pl110.c | 4 +--- hw/display/qxl.h | 4 +--- hw/display/sii9022.c | 4 +--- hw/display/sm501.c | 8 ++------ hw/display/ssd0303.c | 4 +--- hw/display/ssd0323.c | 4 +--- hw/display/tcx.c | 4 +--- hw/display/vga-isa.c | 4 +--- hw/display/vga-pci.c | 4 +--- 22 files changed, 23 insertions(+), 69 deletions(-) (limited to 'hw/display') diff --git a/hw/display/ads7846.c b/hw/display/ads7846.c index 4b87ee7..023165b 100644 --- a/hw/display/ads7846.c +++ b/hw/display/ads7846.c @@ -29,11 +29,9 @@ struct ADS7846State { int cycle; int output; }; -typedef struct ADS7846State ADS7846State; #define TYPE_ADS7846 "ads7846" -DECLARE_INSTANCE_CHECKER(ADS7846State, ADS7846, - TYPE_ADS7846) +OBJECT_DECLARE_SIMPLE_TYPE(ADS7846State, ADS7846) /* Control-byte bitfields */ #define CB_PD0 (1 << 0) diff --git a/hw/display/artist.c b/hw/display/artist.c index 80cd66e..ed0e637 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -25,9 +25,7 @@ #include "qom/object.h" #define TYPE_ARTIST "artist" -typedef struct ARTISTState ARTISTState; -DECLARE_INSTANCE_CHECKER(ARTISTState, ARTIST, - TYPE_ARTIST) +OBJECT_DECLARE_SIMPLE_TYPE(ARTISTState, ARTIST) #ifdef HOST_WORDS_BIGENDIAN #define ROP8OFF(_i) (3 - (_i)) diff --git a/hw/display/ati_int.h b/hw/display/ati_int.h index 7140054..8acb9c7 100644 --- a/hw/display/ati_int.h +++ b/hw/display/ati_int.h @@ -30,9 +30,7 @@ #define PCI_DEVICE_ID_ATI_RADEON_QY 0x5159 #define TYPE_ATI_VGA "ati-vga" -typedef struct ATIVGAState ATIVGAState; -DECLARE_INSTANCE_CHECKER(ATIVGAState, ATI_VGA, - TYPE_ATI_VGA) +OBJECT_DECLARE_SIMPLE_TYPE(ATIVGAState, ATI_VGA) typedef struct ATIVGARegs { uint32_t mm_index; diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c index 4158738..8ed734b 100644 --- a/hw/display/bochs-display.c +++ b/hw/display/bochs-display.c @@ -55,11 +55,9 @@ struct BochsDisplayState { /* device state */ BochsDisplayMode mode; }; -typedef struct BochsDisplayState BochsDisplayState; #define TYPE_BOCHS_DISPLAY "bochs-display" -DECLARE_INSTANCE_CHECKER(BochsDisplayState, BOCHS_DISPLAY, - TYPE_BOCHS_DISPLAY) +OBJECT_DECLARE_SIMPLE_TYPE(BochsDisplayState, BOCHS_DISPLAY) static const VMStateDescription vmstate_bochs_display = { .name = "bochs-display", diff --git a/hw/display/cg3.c b/hw/display/cg3.c index d66ba9a..42fcf40 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -66,9 +66,7 @@ #define CG3_VRAM_OFFSET 0x800000 #define TYPE_CG3 "cgthree" -typedef struct CG3State CG3State; -DECLARE_INSTANCE_CHECKER(CG3State, CG3, - TYPE_CG3) +OBJECT_DECLARE_SIMPLE_TYPE(CG3State, CG3) struct CG3State { SysBusDevice parent_obj; diff --git a/hw/display/cirrus_vga.c b/hw/display/cirrus_vga.c index c088f38..722b9e7 100644 --- a/hw/display/cirrus_vga.c +++ b/hw/display/cirrus_vga.c @@ -183,11 +183,9 @@ struct PCICirrusVGAState { PCIDevice dev; CirrusVGAState cirrus_vga; }; -typedef struct PCICirrusVGAState PCICirrusVGAState; #define TYPE_PCI_CIRRUS_VGA "cirrus-vga" -DECLARE_INSTANCE_CHECKER(PCICirrusVGAState, PCI_CIRRUS_VGA, - TYPE_PCI_CIRRUS_VGA) +OBJECT_DECLARE_SIMPLE_TYPE(PCICirrusVGAState, PCI_CIRRUS_VGA) static uint8_t rop_to_index[256]; diff --git a/hw/display/cirrus_vga_isa.c b/hw/display/cirrus_vga_isa.c index e6adee1..4f6fb1a 100644 --- a/hw/display/cirrus_vga_isa.c +++ b/hw/display/cirrus_vga_isa.c @@ -33,9 +33,7 @@ #include "qom/object.h" #define TYPE_ISA_CIRRUS_VGA "isa-cirrus-vga" -typedef struct ISACirrusVGAState ISACirrusVGAState; -DECLARE_INSTANCE_CHECKER(ISACirrusVGAState, ISA_CIRRUS_VGA, - TYPE_ISA_CIRRUS_VGA) +OBJECT_DECLARE_SIMPLE_TYPE(ISACirrusVGAState, ISA_CIRRUS_VGA) struct ISACirrusVGAState { ISADevice parent_obj; diff --git a/hw/display/exynos4210_fimd.c b/hw/display/exynos4210_fimd.c index 3ef8698..4c16e1f 100644 --- a/hw/display/exynos4210_fimd.c +++ b/hw/display/exynos4210_fimd.c @@ -294,9 +294,7 @@ struct Exynos4210fimdWindow { }; #define TYPE_EXYNOS4210_FIMD "exynos4210.fimd" -typedef struct Exynos4210fimdState Exynos4210fimdState; -DECLARE_INSTANCE_CHECKER(Exynos4210fimdState, EXYNOS4210_FIMD, - TYPE_EXYNOS4210_FIMD) +OBJECT_DECLARE_SIMPLE_TYPE(Exynos4210fimdState, EXYNOS4210_FIMD) struct Exynos4210fimdState { SysBusDevice parent_obj; diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 4a32fe4..8f17254 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -487,9 +487,7 @@ static void g364fb_init(DeviceState *dev, G364State *s) } #define TYPE_G364 "sysbus-g364" -typedef struct G364SysBusState G364SysBusState; -DECLARE_INSTANCE_CHECKER(G364SysBusState, G364, - TYPE_G364) +OBJECT_DECLARE_SIMPLE_TYPE(G364SysBusState, G364) struct G364SysBusState { SysBusDevice parent_obj; diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c index 647d05f..dd5f469 100644 --- a/hw/display/jazz_led.c +++ b/hw/display/jazz_led.c @@ -36,9 +36,7 @@ typedef enum { } screen_state_t; #define TYPE_JAZZ_LED "jazz-led" -typedef struct LedState LedState; -DECLARE_INSTANCE_CHECKER(LedState, JAZZ_LED, - TYPE_JAZZ_LED) +OBJECT_DECLARE_SIMPLE_TYPE(LedState, JAZZ_LED) struct LedState { SysBusDevice parent_obj; diff --git a/hw/display/milkymist-tmu2.c b/hw/display/milkymist-tmu2.c index 8a9e7c2..64636db 100644 --- a/hw/display/milkymist-tmu2.c +++ b/hw/display/milkymist-tmu2.c @@ -83,9 +83,7 @@ struct vertex { } QEMU_PACKED; #define TYPE_MILKYMIST_TMU2 "milkymist-tmu2" -typedef struct MilkymistTMU2State MilkymistTMU2State; -DECLARE_INSTANCE_CHECKER(MilkymistTMU2State, MILKYMIST_TMU2, - TYPE_MILKYMIST_TMU2) +OBJECT_DECLARE_SIMPLE_TYPE(MilkymistTMU2State, MILKYMIST_TMU2) struct MilkymistTMU2State { SysBusDevice parent_obj; diff --git a/hw/display/milkymist-vgafb.c b/hw/display/milkymist-vgafb.c index 2c87912..6f2b11d 100644 --- a/hw/display/milkymist-vgafb.c +++ b/hw/display/milkymist-vgafb.c @@ -69,9 +69,7 @@ enum { }; #define TYPE_MILKYMIST_VGAFB "milkymist-vgafb" -typedef struct MilkymistVgafbState MilkymistVgafbState; -DECLARE_INSTANCE_CHECKER(MilkymistVgafbState, MILKYMIST_VGAFB, - TYPE_MILKYMIST_VGAFB) +OBJECT_DECLARE_SIMPLE_TYPE(MilkymistVgafbState, MILKYMIST_VGAFB) struct MilkymistVgafbState { SysBusDevice parent_obj; diff --git a/hw/display/next-fb.c b/hw/display/next-fb.c index 94db020..e2d8951 100644 --- a/hw/display/next-fb.c +++ b/hw/display/next-fb.c @@ -32,9 +32,7 @@ #include "hw/m68k/next-cube.h" #include "qom/object.h" -typedef struct NeXTFbState NeXTFbState; -DECLARE_INSTANCE_CHECKER(NeXTFbState, NEXTFB, - TYPE_NEXTFB) +OBJECT_DECLARE_SIMPLE_TYPE(NeXTFbState, NEXTFB) struct NeXTFbState { SysBusDevice parent_obj; diff --git a/hw/display/pl110.c b/hw/display/pl110.c index af51a2b..02b0d45 100644 --- a/hw/display/pl110.c +++ b/hw/display/pl110.c @@ -49,9 +49,7 @@ enum pl110_version }; #define TYPE_PL110 "pl110" -typedef struct PL110State PL110State; -DECLARE_INSTANCE_CHECKER(PL110State, PL110, - TYPE_PL110) +OBJECT_DECLARE_SIMPLE_TYPE(PL110State, PL110) struct PL110State { SysBusDevice parent_obj; diff --git a/hw/display/qxl.h b/hw/display/qxl.h index 714cd01..379d330 100644 --- a/hw/display/qxl.h +++ b/hw/display/qxl.h @@ -128,11 +128,9 @@ struct PCIQXLDevice { QXLRect dirty[QXL_NUM_DIRTY_RECTS]; QEMUBH *update_area_bh; }; -typedef struct PCIQXLDevice PCIQXLDevice; #define TYPE_PCI_QXL "pci-qxl" -DECLARE_INSTANCE_CHECKER(PCIQXLDevice, PCI_QXL, - TYPE_PCI_QXL) +OBJECT_DECLARE_SIMPLE_TYPE(PCIQXLDevice, PCI_QXL) #define PANIC_ON(x) if ((x)) { \ printf("%s: PANIC %s failed\n", __func__, #x); \ diff --git a/hw/display/sii9022.c b/hw/display/sii9022.c index d88166f..b591a58 100644 --- a/hw/display/sii9022.c +++ b/hw/display/sii9022.c @@ -36,9 +36,7 @@ #define SII9022_INT_STATUS_PLUGGED 0x04; #define TYPE_SII9022 "sii9022" -typedef struct sii9022_state sii9022_state; -DECLARE_INSTANCE_CHECKER(sii9022_state, SII9022, - TYPE_SII9022) +OBJECT_DECLARE_SIMPLE_TYPE(sii9022_state, SII9022) struct sii9022_state { I2CSlave parent_obj; diff --git a/hw/display/sm501.c b/hw/display/sm501.c index 51120c6..8966b69 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -1932,9 +1932,7 @@ static const VMStateDescription vmstate_sm501_state = { }; #define TYPE_SYSBUS_SM501 "sysbus-sm501" -typedef struct SM501SysBusState SM501SysBusState; -DECLARE_INSTANCE_CHECKER(SM501SysBusState, SYSBUS_SM501, - TYPE_SYSBUS_SM501) +OBJECT_DECLARE_SIMPLE_TYPE(SM501SysBusState, SYSBUS_SM501) struct SM501SysBusState { /*< private >*/ @@ -2036,9 +2034,7 @@ static const TypeInfo sm501_sysbus_info = { }; #define TYPE_PCI_SM501 "sm501" -typedef struct SM501PCIState SM501PCIState; -DECLARE_INSTANCE_CHECKER(SM501PCIState, PCI_SM501, - TYPE_PCI_SM501) +OBJECT_DECLARE_SIMPLE_TYPE(SM501PCIState, PCI_SM501) struct SM501PCIState { /*< private >*/ diff --git a/hw/display/ssd0303.c b/hw/display/ssd0303.c index 0378573..aeae22d 100644 --- a/hw/display/ssd0303.c +++ b/hw/display/ssd0303.c @@ -47,9 +47,7 @@ enum ssd0303_cmd { }; #define TYPE_SSD0303 "ssd0303" -typedef struct ssd0303_state ssd0303_state; -DECLARE_INSTANCE_CHECKER(ssd0303_state, SSD0303, - TYPE_SSD0303) +OBJECT_DECLARE_SIMPLE_TYPE(ssd0303_state, SSD0303) struct ssd0303_state { I2CSlave parent_obj; diff --git a/hw/display/ssd0323.c b/hw/display/ssd0323.c index 037da81..17d4b32 100644 --- a/hw/display/ssd0323.c +++ b/hw/display/ssd0323.c @@ -66,11 +66,9 @@ struct ssd0323_state { uint32_t mode; uint8_t framebuffer[128 * 80 / 2]; }; -typedef struct ssd0323_state ssd0323_state; #define TYPE_SSD0323 "ssd0323" -DECLARE_INSTANCE_CHECKER(ssd0323_state, SSD0323, - TYPE_SSD0323) +OBJECT_DECLARE_SIMPLE_TYPE(ssd0323_state, SSD0323) static uint32_t ssd0323_transfer(SSISlave *dev, uint32_t data) diff --git a/hw/display/tcx.c b/hw/display/tcx.c index 69e901a..c9d5e45 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -56,9 +56,7 @@ #define TCX_THC_CURSBITS 0x980 #define TYPE_TCX "SUNW,tcx" -typedef struct TCXState TCXState; -DECLARE_INSTANCE_CHECKER(TCXState, TCX, - TYPE_TCX) +OBJECT_DECLARE_SIMPLE_TYPE(TCXState, TCX) struct TCXState { SysBusDevice parent_obj; diff --git a/hw/display/vga-isa.c b/hw/display/vga-isa.c index 0ebfcca..90851e7 100644 --- a/hw/display/vga-isa.c +++ b/hw/display/vga-isa.c @@ -35,9 +35,7 @@ #include "qom/object.h" #define TYPE_ISA_VGA "isa-vga" -typedef struct ISAVGAState ISAVGAState; -DECLARE_INSTANCE_CHECKER(ISAVGAState, ISA_VGA, - TYPE_ISA_VGA) +OBJECT_DECLARE_SIMPLE_TYPE(ISAVGAState, ISA_VGA) struct ISAVGAState { ISADevice parent_obj; diff --git a/hw/display/vga-pci.c b/hw/display/vga-pci.c index 3b45fa3..e5d9af5 100644 --- a/hw/display/vga-pci.c +++ b/hw/display/vga-pci.c @@ -51,11 +51,9 @@ struct PCIVGAState { MemoryRegion mrs[4]; uint8_t edid[256]; }; -typedef struct PCIVGAState PCIVGAState; #define TYPE_PCI_VGA "pci-vga" -DECLARE_INSTANCE_CHECKER(PCIVGAState, PCI_VGA, - TYPE_PCI_VGA) +OBJECT_DECLARE_SIMPLE_TYPE(PCIVGAState, PCI_VGA) static const VMStateDescription vmstate_vga_pci = { .name = "vga", -- cgit v1.1