Received: from eggs.gnu.org ([208.118.235.92]:49916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWBac-0000fL-3O for qemu-devel@nongnu.org; Sat, 27 Apr 2013 16:19:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UWBaZ-0002GQ-9m for qemu-devel@nongnu.org; Sat, 27 Apr 2013 16:19:21 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41918 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UWBaY-0002Ew-UD for qemu-devel@nongnu.org; Sat, 27 Apr 2013 16:19:19 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7B7C15E00020C for ; Sat, 27 Apr 2013 22:19:18 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sat, 27 Apr 2013 22:18:50 +0200 Message-Id: <1367093935-29091-16-git-send-email-afaerber@suse.de> In-Reply-To: <1367093935-29091-1-git-send-email-afaerber@suse.de> References: <1367093935-29091-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] [PATCH for-1.5 v2 15/20] 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?= Introduce type constant and cast macro to obsolete DO_UPCAST(). Prepares for ISA realizefn. Signed-off-by: Andreas F=C3=A4rber --- hw/char/serial-isa.c | 11 +++++++---- include/hw/char/serial.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index ed140d0..342b4cc 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -26,8 +26,11 @@ #include "hw/char/serial.h" #include "hw/isa/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) { @@ -100,7 +103,7 @@ static void serial_isa_class_initfn(ObjectClass *klas= s, void *data) } =20 static const TypeInfo serial_isa_info =3D { - .name =3D "isa-serial", + .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/include/hw/char/serial.h b/include/hw/char/serial.h index e884499..bca79f1 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -96,6 +96,7 @@ 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 #endif --=20 1.8.1.4