Received: from eggs.gnu.org ([208.118.235.92]:33544) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKW-0007NW-4J for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TcmKT-0000Hd-Cl for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:44 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46228 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000Gr-5z 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:29 +0100 Message-Id: <1353888766-6951-18-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 17/34] parallel: 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/parallel.c | 13 +++++++++---- 1 Datei ge=C3=A4ndert, 9 Zeilen hinzugef=C3=BCgt(+), 4 Zeilen entfernt(-= ) diff --git a/hw/parallel.c b/hw/parallel.c index c4705bc..65447d3 100644 --- a/hw/parallel.c +++ b/hw/parallel.c @@ -80,8 +80,13 @@ typedef struct ParallelState { int it_shift; } ParallelState; =20 +#define TYPE_ISA_PARALLEL "isa-parallel" +#define ISA_PARALLEL(obj) \ + OBJECT_CHECK(ISAParallelState, (obj), TYPE_ISA_PARALLEL) + typedef struct ISAParallelState { - ISADevice dev; + ISADevice parent_obj; + uint32_t index; uint32_t iobase; uint32_t isairq; @@ -475,7 +480,7 @@ static const MemoryRegionPortio isa_parallel_portio_s= w_list[] =3D { static int parallel_isa_initfn(ISADevice *dev) { static int index; - ISAParallelState *isa =3D DO_UPCAST(ISAParallelState, dev, dev); + ISAParallelState *isa =3D ISA_PARALLEL(dev); ParallelState *s =3D &isa->state; int base; uint8_t dummy; @@ -599,8 +604,8 @@ static void parallel_isa_class_initfn(ObjectClass *kl= ass, void *data) dc->props =3D parallel_isa_properties; } =20 -static TypeInfo parallel_isa_info =3D { - .name =3D "isa-parallel", +static const TypeInfo parallel_isa_info =3D { + .name =3D TYPE_ISA_PARALLEL, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(ISAParallelState), .class_init =3D parallel_isa_class_initfn, --=20 1.7.10.4