Introduce type constant and cast macro to obsolete DO_UPCAST().

Prepares for ISA realizefn.

Signed-off-by: Andreas Färber <afaer...@suse.de>
---
 hw/cirrus_vga.c |   17 +++++++++++------
 1 Datei geändert, 11 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 40efa8a..9687b6b 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -250,8 +250,13 @@ typedef struct PCICirrusVGAState {
     CirrusVGAState cirrus_vga;
 } PCICirrusVGAState;
 
+#define TYPE_ISA_CIRRUS_VGA "isa-cirrus-vga"
+#define ISA_CIRRUS_VGA(obj) \
+    OBJECT_CHECK(ISACirrusVGAState, (obj), TYPE_ISA_CIRRUS_VGA)
+
 typedef struct ISACirrusVGAState {
-    ISADevice dev;
+    ISADevice parent_obj;
+
     CirrusVGAState cirrus_vga;
 } ISACirrusVGAState;
 
@@ -2902,7 +2907,7 @@ static void cirrus_init_common(CirrusVGAState * s, int 
device_id, int is_pci,
 
 static int vga_initfn(ISADevice *dev)
 {
-    ISACirrusVGAState *d = DO_UPCAST(ISACirrusVGAState, dev, dev);
+    ISACirrusVGAState *d = ISA_CIRRUS_VGA(dev);
     VGACommonState *s = &d->cirrus_vga.vga;
 
     vga_common_init(s);
@@ -2917,7 +2922,7 @@ static int vga_initfn(ISADevice *dev)
     return 0;
 }
 
-static Property isa_vga_cirrus_properties[] = {
+static Property isa_cirrus_vga_properties[] = {
     DEFINE_PROP_UINT32("vgamem_mb", struct ISACirrusVGAState,
                        cirrus_vga.vga.vram_size_mb, 8),
     DEFINE_PROP_END_OF_LIST(),
@@ -2930,11 +2935,11 @@ static void isa_cirrus_vga_class_init(ObjectClass 
*klass, void *data)
 
     dc->vmsd  = &vmstate_cirrus_vga;
     k->init   = vga_initfn;
-    dc->props = isa_vga_cirrus_properties;
+    dc->props = isa_cirrus_vga_properties;
 }
 
-static TypeInfo isa_cirrus_vga_info = {
-    .name          = "isa-cirrus-vga",
+static const TypeInfo isa_cirrus_vga_info = {
+    .name          = TYPE_ISA_CIRRUS_VGA,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(ISACirrusVGAState),
     .class_init = isa_cirrus_vga_class_init,
-- 
1.7.10.4


Reply via email to