@@ -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,
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(-)