Received: from eggs.gnu.org ([208.118.235.92]:33559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKX-0007Ob-39 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-0000IF-HU for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46229 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000Gv-6i 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:30 +0100 Message-Id: <1353888766-6951-19-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 18/34] pc: QOM'ify port 92 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , =?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/pc.c | 16 ++++++++++------ 1 Datei ge=C3=A4ndert, 10 Zeilen hinzugef=C3=BCgt(+), 6 Zeilen entfernt(= -) diff --git a/hw/pc.c b/hw/pc.c index 5fc2076..e878106 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -413,9 +413,13 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t ab= ove_4g_mem_size, qemu_register_reset(pc_cmos_init_late, &arg); } =20 +#define TYPE_PORT92 "port92" +#define PORT92(obj) OBJECT_CHECK(Port92State, (obj), TYPE_PORT92) + /* port 92 stuff: could be split off */ typedef struct Port92State { - ISADevice dev; + ISADevice parent_obj; + MemoryRegion io; uint8_t outport; qemu_irq *a20_out; @@ -447,7 +451,7 @@ static uint64_t port92_read(void *opaque, hwaddr addr= , =20 static void port92_init(ISADevice *dev, qemu_irq *a20_out) { - Port92State *s =3D DO_UPCAST(Port92State, dev, dev); + Port92State *s =3D PORT92(dev); =20 s->a20_out =3D a20_out; } @@ -465,7 +469,7 @@ static const VMStateDescription vmstate_port92_isa =3D= { =20 static void port92_reset(DeviceState *d) { - Port92State *s =3D container_of(d, Port92State, dev.qdev); + Port92State *s =3D PORT92(d); =20 s->outport &=3D ~1; } @@ -482,7 +486,7 @@ static const MemoryRegionOps port92_ops =3D { =20 static int port92_initfn(ISADevice *dev) { - Port92State *s =3D DO_UPCAST(Port92State, dev, dev); + Port92State *s =3D PORT92(dev); =20 memory_region_init_io(&s->io, &port92_ops, s, "port92", 1); isa_register_ioport(dev, &s->io, 0x92); @@ -501,8 +505,8 @@ static void port92_class_initfn(ObjectClass *klass, v= oid *data) dc->vmsd =3D &vmstate_port92_isa; } =20 -static TypeInfo port92_info =3D { - .name =3D "port92", +static const TypeInfo port92_info =3D { + .name =3D TYPE_PORT92, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(Port92State), .class_init =3D port92_class_initfn, --=20 1.7.10.4