summaryrefslogtreecommitdiff
path: root/hw/char/milkymist-uart.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2013-07-24 23:08:14 +0200
committerAndreas Färber <afaerber@suse.de>2013-07-29 21:06:28 +0200
commit79bbe8bf3dbd701a13e2abe0ca0acdfae3e2231d (patch)
tree1829110df65b3a020780d5046aa7fda9b0525b8b /hw/char/milkymist-uart.c
parent85f3d3024588d27453788167566c34c3c658881d (diff)
downloadqemu-79bbe8bf3dbd701a13e2abe0ca0acdfae3e2231d.zip
milkymist-uart: QOM cast cleanup
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/char/milkymist-uart.c')
-rw-r--r--hw/char/milkymist-uart.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index 46deab2c51..2e4b5c58b0 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -52,8 +52,13 @@ enum {
DBG_BREAK_EN = (1<<0),
};
+#define TYPE_MILKYMIST_UART "milkymist-uart"
+#define MILKYMIST_UART(obj) \
+ OBJECT_CHECK(MilkymistUartState, (obj), TYPE_MILKYMIST_UART)
+
struct MilkymistUartState {
- SysBusDevice busdev;
+ SysBusDevice parent_obj;
+
MemoryRegion regs_region;
CharDriverState *chr;
qemu_irq irq;
@@ -179,7 +184,7 @@ static void uart_event(void *opaque, int event)
static void milkymist_uart_reset(DeviceState *d)
{
- MilkymistUartState *s = container_of(d, MilkymistUartState, busdev.qdev);
+ MilkymistUartState *s = MILKYMIST_UART(d);
int i;
for (i = 0; i < R_MAX; i++) {
@@ -192,12 +197,12 @@ static void milkymist_uart_reset(DeviceState *d)
static int milkymist_uart_init(SysBusDevice *dev)
{
- MilkymistUartState *s = FROM_SYSBUS(typeof(*s), dev);
+ MilkymistUartState *s = MILKYMIST_UART(dev);
sysbus_init_irq(dev, &s->irq);
memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s,
- "milkymist-uart", R_MAX * 4);
+ "milkymist-uart", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region);
s->chr = qemu_char_get_next_serial();
@@ -230,7 +235,7 @@ static void milkymist_uart_class_init(ObjectClass *klass, void *data)
}
static const TypeInfo milkymist_uart_info = {
- .name = "milkymist-uart",
+ .name = TYPE_MILKYMIST_UART,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MilkymistUartState),
.class_init = milkymist_uart_class_init,