diff mbox

[RFC,08/34] debugcon: QOM'ify ISA debug console

Message ID 1353888766-6951-9-git-send-email-afaerber@suse.de
State New
Headers show

Commit Message

Andreas Färber Nov. 26, 2012, 12:12 a.m. UTC
Introduce type constant and cast macro to obsolete DO_UPCAST().

Prepares for ISA realizefn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 hw/debugcon.c |   13 +++++++++----
 1 Datei geändert, 9 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-)
diff mbox

Patch

diff --git a/hw/debugcon.c b/hw/debugcon.c
index 14ab326..02846ed 100644
--- a/hw/debugcon.c
+++ b/hw/debugcon.c
@@ -36,8 +36,13 @@  typedef struct DebugconState {
     uint32_t readback;
 } DebugconState;
 
+#define TYPE_ISA_DEBUG_CONSOLE "isa-debugcon"
+#define ISA_DEBUG_CONSOLE(obj) \
+    OBJECT_CHECK(ISADebugconState, (obj), TYPE_ISA_DEBUG_CONSOLE)
+
 typedef struct ISADebugconState {
-    ISADevice dev;
+    ISADevice parent_obj;
+
     uint32_t iobase;
     DebugconState state;
 } ISADebugconState;
@@ -78,7 +83,7 @@  static void debugcon_init_core(DebugconState *s)
 
 static int debugcon_isa_initfn(ISADevice *dev)
 {
-    ISADebugconState *isa = DO_UPCAST(ISADebugconState, dev, dev);
+    ISADebugconState *isa = ISA_DEBUG_CONSOLE(dev);
     DebugconState *s = &isa->state;
 
     debugcon_init_core(s);
@@ -102,8 +107,8 @@  static void debugcon_isa_class_initfn(ObjectClass *klass, void *data)
     dc->props = debugcon_isa_properties;
 }
 
-static TypeInfo debugcon_isa_info = {
-    .name          = "isa-debugcon",
+static const TypeInfo debugcon_isa_info = {
+    .name          = TYPE_ISA_DEBUG_CONSOLE,
     .parent        = TYPE_ISA_DEVICE,
     .instance_size = sizeof(ISADebugconState),
     .class_init    = debugcon_isa_class_initfn,