Received: from eggs.gnu.org ([208.118.235.92]:33601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKY-0007SF-75 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-0000In-KE for qemu-devel@nongnu.org; Sun, 25 Nov 2012 19:13:46 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46233 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TcmKT-0000H7-9g 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:34 +0100 Message-Id: <1353888766-6951-23-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 22/34] serial: QOM'ify ISA serial 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/serial-isa.c | 13 ++++++++----- hw/serial.h | 1 + 2 Dateien ge=C3=A4ndert, 9 Zeilen hinzugef=C3=BCgt(+), 5 Zeilen entfernt= (-) diff --git a/hw/serial-isa.c b/hw/serial-isa.c index 96c78f7..904cc41 100644 --- a/hw/serial-isa.c +++ b/hw/serial-isa.c @@ -26,8 +26,11 @@ #include "serial.h" #include "isa.h" =20 +#define ISA_SERIAL(obj) OBJECT_CHECK(ISASerialState, (obj), TYPE_ISA_SER= IAL) + typedef struct ISASerialState { - ISADevice dev; + ISADevice parent_obj; + uint32_t index; uint32_t iobase; uint32_t isairq; @@ -44,7 +47,7 @@ static const int isa_serial_irq[MAX_SERIAL_PORTS] =3D { static int serial_isa_initfn(ISADevice *dev) { static int index; - ISASerialState *isa =3D DO_UPCAST(ISASerialState, dev, dev); + ISASerialState *isa =3D ISA_SERIAL(dev); SerialState *s =3D &isa->state; =20 if (isa->index =3D=3D -1) { @@ -99,8 +102,8 @@ static void serial_isa_class_initfn(ObjectClass *klass= , void *data) dc->props =3D serial_isa_properties; } =20 -static TypeInfo serial_isa_info =3D { - .name =3D "isa-serial", +static const TypeInfo serial_isa_info =3D { + .name =3D TYPE_ISA_SERIAL, .parent =3D TYPE_ISA_DEVICE, .instance_size =3D sizeof(ISASerialState), .class_init =3D serial_isa_class_initfn, @@ -117,7 +120,7 @@ bool serial_isa_init(ISABus *bus, int index, CharDriv= erState *chr) { ISADevice *dev; =20 - dev =3D isa_try_create(bus, "isa-serial"); + dev =3D isa_try_create(bus, TYPE_ISA_SERIAL); if (!dev) { return false; } diff --git a/hw/serial.h b/hw/serial.h index ed1a5cd..bb06366 100644 --- a/hw/serial.h +++ b/hw/serial.h @@ -96,4 +96,5 @@ SerialState *serial_mm_init(MemoryRegion *address_space= , CharDriverState *chr, enum device_endian end= ); =20 /* serial-isa.c */ +#define TYPE_ISA_SERIAL "isa-serial" bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr); --=20 1.7.10.4