From patchwork Mon Nov 26 00:12:33 2012 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: 201590 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 73C612C008A for ; Mon, 26 Nov 2012 11:14:53 +1100 (EST) Received: from localhost ([::1]:42528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmLb-0000lS-H7 for incoming@patchwork.ozlabs.org; Sun, 25 Nov 2012 19:14:51 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKW-0007Np-Q3 for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TcmKT-0000I7-Fz for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:44 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46232 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000H6-9V for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:41 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 44195A3991; Mon, 26 Nov 2012 01:13:18 +0100 (CET) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2012 01:12:33 +0100 Message-Id: <1353888766-6951-22-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.10.4 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 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?= , anthony@codemonkey.ws Subject: [Qemu-devel] [RFC 21/34] sb16: 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. Signed-off-by: Andreas Färber --- hw/sb16.c | 16 +++++++++------- 1 Datei geändert, 9 Zeilen hinzugefügt(+), 7 Zeilen entfernt(-) diff --git a/hw/sb16.c b/hw/sb16.c index 523ab0d..b7e93a4 100644 --- a/hw/sb16.c +++ b/hw/sb16.c @@ -47,8 +47,12 @@ static const char e3[] = "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992."; +#define TYPE_SB16 "sb16" +#define SB16(obj) OBJECT_CHECK (SB16State, (obj), TYPE_SB16) + typedef struct SB16State { - ISADevice dev; + ISADevice parent_obj; + QEMUSoundCard card; qemu_irq pic; uint32_t irq; @@ -1354,9 +1358,7 @@ static const MemoryRegionPortio sb16_ioport_list[] = { static int sb16_initfn (ISADevice *dev) { - SB16State *s; - - s = DO_UPCAST (SB16State, dev, dev); + SB16State *s = SB16 (dev); s->cmd = -1; isa_init_irq (dev, &s->pic, s->irq); @@ -1386,7 +1388,7 @@ static int sb16_initfn (ISADevice *dev) int SB16_init (ISABus *bus) { - isa_create_simple (bus, "sb16"); + isa_create_simple (bus, TYPE_SB16); return 0; } @@ -1409,8 +1411,8 @@ static void sb16_class_initfn (ObjectClass *klass, void *data) dc->props = sb16_properties; } -static TypeInfo sb16_info = { - .name = "sb16", +static const TypeInfo sb16_info = { + .name = TYPE_SB16, .parent = TYPE_ISA_DEVICE, .instance_size = sizeof (SB16State), .class_init = sb16_class_initfn,