From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 26 Nov 2012 01:12:33 +0100 Message-Id: <1353888766-6951-22-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 21/34] sb16: 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. Signed-off-by: Andreas F=C3=A4rber --- hw/sb16.c | 16 +++++++++------- 1 Datei ge=C3=A4ndert, 9 Zeilen hinzugef=C3=BCgt(+), 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 @@ =20 static const char e3[] =3D "COPYRIGHT (C) CREATIVE TECHNOLOGY LTD, 1992.= "; =20 +#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[] = =3D { =20 static int sb16_initfn (ISADevice *dev) { - SB16State *s; - - s =3D DO_UPCAST (SB16State, dev, dev); + SB16State *s =3D SB16 (dev); =20 s->cmd =3D -1; isa_init_irq (dev, &s->pic, s->irq); @@ -1386,7 +1388,7 @@ static int sb16_initfn (ISADevice *dev) =20 int SB16_init (ISABus *bus) { - isa_create_simple (bus, "sb16"); + isa_create_simple (bus, TYPE_SB16); return 0; } =20 @@ -1409,8 +1411,8 @@ static void sb16_class_initfn (ObjectClass *klass, = void *data) dc->props =3D sb16_properties; } =20 -static TypeInfo sb16_info =3D { - .name =3D "sb16", +static const TypeInfo sb16_info =3D { + .name =3D TYPE_SB16, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof (SB16State), .class_init =3D sb16_class_initfn, --=20 1.7.10.4