From patchwork Sat Apr 27 20:18:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 240192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 510AA2C0097 for ; Sun, 28 Apr 2013 06:29:02 +1000 (EST) Received: from localhost ([::1]:34240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWBjw-0006fT-Id for incoming@patchwork.ozlabs.org; Sat, 27 Apr 2013 16:29:00 -0400 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?= To: qemu-devel@nongnu.org Date: Sat, 27 Apr 2013 22:18:54 +0200 Message-Id: <1367093935-29091-20-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 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 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH for-1.5 v2 19/20] vmport: QOM'ify X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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 -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,