[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 26/34] vmport: QOM'ify
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [RFC 26/34] vmport: QOM'ify |
Date: |
Mon, 26 Nov 2012 01:12:38 +0100 |
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 <address@hidden>
---
hw/vmport.c | 14 +++++++++-----
1 Datei geändert, 9 Zeilen hinzugefügt(+), 5 Zeilen entfernt(-)
diff --git a/hw/vmport.c b/hw/vmport.c
index 3ab3a14..ec36d47 100644
--- a/hw/vmport.c
+++ b/hw/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);
@@ -155,8 +159,8 @@ static void vmport_class_initfn(ObjectClass *klass, void
*data)
dc->no_user = 1;
}
-static TypeInfo vmport_info = {
- .name = "vmport",
+static const TypeInfo vmport_info = {
+ .name = TYPE_VMPORT,
.parent = TYPE_ISA_DEVICE,
.instance_size = sizeof(VMPortState),
.class_init = vmport_class_initfn,
--
1.7.10.4
- [Qemu-devel] [RFC 03/34] qdev: Fold state enum into bool realized, (continued)
- [Qemu-devel] [RFC 03/34] qdev: Fold state enum into bool realized, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 30/34] kvm/i8254: QOM'ify some more, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 33/34] kvm/i8259: QOM'ify some more, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 34/34] i8259: Convert PICCommonState to use QOM realizefn, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 19/34] pckbd: QOM'ify, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 31/34] i8254: Convert PITCommonState to QOM realizefn, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 27/34] wdt_ib700: QOM'ify, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 16/34] ne2000-isa: QOM'ify, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 04/34] qdev: Prepare "realized" property, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 20/34] pcspk: QOM'ify, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 26/34] vmport: QOM'ify,
Andreas Färber <=
- [Qemu-devel] [RFC 25/34] vmmouse: QOM'ify, Andreas Färber, 2012/11/25
- [Qemu-devel] [RFC 28/34] isa: Use realizefn for ISADevice, Andreas Färber, 2012/11/25