diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-24 23:37:28 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-07-29 20:45:45 +0200 |
commit | 24bf6c1f2a0ab42e4f183a10b9e9cfe468a840b3 (patch) | |
tree | 5aae9c9dfcf7124f59999fbd2f69f2e7351c5257 /hw/char/xilinx_uartlite.c | |
parent | 144712ca149f49b24e27b537d05943ee8ac9e22b (diff) |
xilinx_uartlite: QOM cast cleanups
Introduce type constant and use QOM casts.
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/char/xilinx_uartlite.c')
-rw-r--r-- | hw/char/xilinx_uartlite.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index 929743c486..b0d1d04af7 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -46,8 +46,13 @@ #define CONTROL_RST_RX 0x02 #define CONTROL_IE 0x10 +#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite" +#define XILINX_UARTLITE(obj) \ + OBJECT_CHECK(XilinxUARTLite, (obj), TYPE_XILINX_UARTLITE) + typedef struct XilinxUARTLite { - SysBusDevice busdev; + SysBusDevice parent_obj; + MemoryRegion mmio; CharDriverState *chr; qemu_irq irq; @@ -193,7 +198,7 @@ static void uart_event(void *opaque, int event) static int xilinx_uartlite_init(SysBusDevice *dev) { - XilinxUARTLite *s = FROM_SYSBUS(typeof (*s), dev); + XilinxUARTLite *s = XILINX_UARTLITE(dev); sysbus_init_irq(dev, &s->irq); @@ -216,7 +221,7 @@ static void xilinx_uartlite_class_init(ObjectClass *klass, void *data) } static const TypeInfo xilinx_uartlite_info = { - .name = "xlnx.xps-uartlite", + .name = TYPE_XILINX_UARTLITE, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(XilinxUARTLite), .class_init = xilinx_uartlite_class_init, |