diff options
author | Peter Crosthwaite <peter.crosthwaite@xilinx.com> | 2014-05-29 02:25:37 -0700 |
---|---|---|
committer | Edgar E. Iglesias <edgar.iglesias@gmail.com> | 2014-06-09 00:33:03 +0200 |
commit | aa0f607f618240958974adb39c7957ee54485d90 (patch) | |
tree | a81cbb2f71517c09fd6afd4871fe2de55524a15e /hw/char | |
parent | 95faaa73dfe705a3c6411d855cdbf099c596ec25 (diff) |
char: xilinx_uartlite: Convert to realize()
SysBusDevice::init is depracated. Convert to Object::init and
Device::realize as prescribed by QOM conventions.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Diffstat (limited to 'hw/char')
-rw-r--r-- | hw/char/xilinx_uartlite.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index d810e5f227..f7c3cae2fa 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -201,35 +201,39 @@ static void uart_event(void *opaque, int event) } -static int xilinx_uartlite_init(SysBusDevice *dev) +static void xilinx_uartlite_realize(DeviceState *dev, Error **errp) { XilinxUARTLite *s = XILINX_UARTLITE(dev); - sysbus_init_irq(dev, &s->irq); - - memory_region_init_io(&s->mmio, OBJECT(s), &uart_ops, s, - "xlnx.xps-uartlite", R_MAX * 4); - sysbus_init_mmio(dev, &s->mmio); - s->chr = qemu_char_get_next_serial(); if (s->chr) qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s); - return 0; +} + +static void xilinx_uartlite_init(Object *obj) +{ + XilinxUARTLite *s = XILINX_UARTLITE(obj); + + sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); + + memory_region_init_io(&s->mmio, obj, &uart_ops, s, + "xlnx.xps-uartlite", R_MAX * 4); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); } static void xilinx_uartlite_class_init(ObjectClass *klass, void *data) { - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); DeviceClass *dc = DEVICE_CLASS(klass); - sdc->init = xilinx_uartlite_init; dc->reset = xilinx_uartlite_reset; + dc->realize = xilinx_uartlite_realize; } static const TypeInfo xilinx_uartlite_info = { .name = TYPE_XILINX_UARTLITE, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(XilinxUARTLite), + .instance_init = xilinx_uartlite_init, .class_init = xilinx_uartlite_class_init, }; |