From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKe-0007mK-Vr for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TcmKU-0000Jx-Bj for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:52 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46237 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000IM-PF for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:41 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 26 Nov 2012 01:12:38 +0100 Message-Id: <1353888766-6951-27-git-send-email-afaerber@suse.de> In-Reply-To: <1353888766-6951-1-git-send-email-afaerber@suse.de> References: <1353888766-6951-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [RFC 26/34] vmport: QOM'ify List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , anthony@codemonkey.ws 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=C3=A4rber --- hw/vmport.c | 14 +++++++++----- 1 Datei ge=C3=A4ndert, 9 Zeilen hinzugef=C3=BCgt(+), 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 =20 -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 =3D { =20 static int vmport_initfn(ISADevice *dev) { - VMPortState *s =3D DO_UPCAST(VMPortState, dev, dev); + VMPortState *s =3D VMPORT(dev); =20 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, v= oid *data) dc->no_user =3D 1; } =20 -static TypeInfo vmport_info =3D { - .name =3D "vmport", +static const TypeInfo vmport_info =3D { + .name =3D TYPE_VMPORT, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(VMPortState), .class_init =3D vmport_class_initfn, --=20 1.7.10.4