Received: from eggs.gnu.org ([2001:4830:134:3::10]:56396) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3t0p-0003Y9-Ov for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:21:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V3t0j-0002TU-D6 for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:21:43 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53373 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V3t0j-0002TN-7q for qemu-devel@nongnu.org; Mon, 29 Jul 2013 15:21:37 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 29 Jul 2013 21:18:41 +0200 Message-Id: <1375125630-24869-65-git-send-email-afaerber@suse.de> In-Reply-To: <1375125630-24869-1-git-send-email-afaerber@suse.de> References: <1375125630-24869-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] [PULL 064/173] grlib_apbuart: QOM cast cleanup 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?= , Fabien Chouteau Signed-off-by: Andreas F=C3=A4rber --- hw/char/grlib_apbuart.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 82e1b95..35ef661 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -67,8 +67,13 @@ =20 #define FIFO_LENGTH 1024 =20 +#define TYPE_GRLIB_APB_UART "grlib,apbuart" +#define GRLIB_APB_UART(obj) \ + OBJECT_CHECK(UART, (obj), TYPE_GRLIB_APB_UART) + typedef struct UART { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion iomem; qemu_irq irq; =20 @@ -232,7 +237,7 @@ static const MemoryRegionOps grlib_apbuart_ops =3D { =20 static int grlib_apbuart_init(SysBusDevice *dev) { - UART *uart =3D FROM_SYSBUS(typeof(*uart), dev); + UART *uart =3D GRLIB_APB_UART(dev); =20 qemu_chr_add_handlers(uart->chr, grlib_apbuart_can_receive, @@ -252,7 +257,7 @@ static int grlib_apbuart_init(SysBusDevice *dev) =20 static void grlib_apbuart_reset(DeviceState *d) { - UART *uart =3D container_of(d, UART, busdev.qdev); + UART *uart =3D GRLIB_APB_UART(d); =20 /* Transmitter FIFO and shift registers are always empty in QEMU */ uart->status =3D UART_TRANSMIT_FIFO_EMPTY | UART_TRANSMIT_SHIFT_EMP= TY; @@ -279,7 +284,7 @@ static void grlib_apbuart_class_init(ObjectClass *kla= ss, void *data) } =20 static const TypeInfo grlib_apbuart_info =3D { - .name =3D "grlib,apbuart", + .name =3D TYPE_GRLIB_APB_UART, .parent =3D TYPE_SYS_BUS_DEVICE, .instance_size =3D sizeof(UART), .class_init =3D grlib_apbuart_class_init, --=20 1.8.1.4