From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37453) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V26pN-0002z4-IU for qemu-devel@nongnu.org; Wed, 24 Jul 2013 17:42:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V26pL-0004oe-7q for qemu-devel@nongnu.org; Wed, 24 Jul 2013 17:42:33 -0400 Received: from cantor2.suse.de ([195.135.220.15]:48444 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V26pL-0004oK-1t for qemu-devel@nongnu.org; Wed, 24 Jul 2013 17:42:31 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 24 Jul 2013 23:42:10 +0200 Message-Id: <1374702140-13771-6-git-send-email-afaerber@suse.de> In-Reply-To: <1374702140-13771-1-git-send-email-afaerber@suse.de> References: <1374702140-13771-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 qom-next for-1.6 05/14] grlib_apbuart: 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?= , 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