aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-04-27 22:18:54 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-29 08:27:50 -0500
commitf02317ad4eca65a9a79b474b6d2d77ba87a57185 (patch)
treed8e113c84afd854d027ac10d4eac5f42d60ea301
parente3b7fbead827623ce521c8056a80050e8b35c578 (diff)
vmport: QOM'ify
Introduce type constant and cast macro to obsolete DO_UPCAST(). Prepares for ISA realizefn. Drop reserved underscore from struct name while at it. Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Andreas Färber <afaerber@suse.de> Message-id: 1367093935-29091-20-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--hw/misc/vmport.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hw/misc/vmport.c b/hw/misc/vmport.c
index 0d07ea1fc5..c14612905b 100644
--- a/hw/misc/vmport.c
+++ b/hw/misc/vmport.c
@@ -35,9 +35,13 @@
#define VMPORT_ENTRIES 0x2c
#define VMPORT_MAGIC 0x564D5868
-typedef struct _VMPortState
+#define TYPE_VMPORT "vmport"
+#define VMPORT(obj) OBJECT_CHECK(VMPortState, (obj), TYPE_VMPORT)
+
+typedef struct VMPortState
{
- ISADevice dev;
+ ISADevice parent_obj;
+
MemoryRegion io;
IOPortReadFunc *func[VMPORT_ENTRIES];
void *opaque[VMPORT_ENTRIES];
@@ -135,7 +139,7 @@ static const MemoryRegionOps vmport_ops = {
static int vmport_initfn(ISADevice *dev)
{
- VMPortState *s = DO_UPCAST(VMPortState, dev, dev);
+ VMPortState *s = VMPORT(dev);
memory_region_init_io(&s->io, &vmport_ops, s, "vmport", 1);
isa_register_ioport(dev, &s->io, 0x5658);
@@ -156,7 +160,7 @@ static void vmport_class_initfn(ObjectClass *klass, void *data)
}
static const TypeInfo vmport_info = {
- .name = "vmport",
+ .name = TYPE_VMPORT,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(VMPortState),
.class_init = vmport_class_initfn,