Received: from eggs.gnu.org ([208.118.235.92]:49969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWBaf-0000kw-7s for qemu-devel@nongnu.org; Sat, 27 Apr 2013 16:19:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWBab-0002Lr-U6 for qemu-devel@nongnu.org; Sat, 27 Apr 2013 16:19:25 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41922 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWBab-0002Lc-Jy for qemu-devel@nongnu.org; Sat, 27 Apr 2013 16:19:21 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 30CB95E000209 for ; Sat, 27 Apr 2013 22:19:21 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 27 Apr 2013 22:18:54 +0200 Message-Id: <1367093935-29091-20-git-send-email-afaerber@suse.de> In-Reply-To: <1367093935-29091-1-git-send-email-afaerber@suse.de> References: <1367093935-29091-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] [PATCH for-1.5 v2 19/20] 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?= 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/misc/vmport.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/misc/vmport.c b/hw/misc/vmport.c index 0d07ea1..c146129 100644 --- a/hw/misc/vmport.c +++ b/hw/misc/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); @@ -156,7 +160,7 @@ static void vmport_class_initfn(ObjectClass *klass, v= oid *data) } =20 static const TypeInfo vmport_info =3D { - .name =3D "vmport", + .name =3D TYPE_VMPORT, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(VMPortState), .class_init =3D vmport_class_initfn, --=20 1.8.1.4