aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMao Zhongyi <maozhongyi@cmss.chinamobile.com>2018-12-13 13:47:57 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-12-13 13:47:57 +0000
commitddaa6e049fc502fbd9cdaeb96d0c5e6c45878fb6 (patch)
treee1845df647548f63a2f393da7e614f0a48c1c190 /hw
parent887c74ca19ceebffb59eb0e039e5d321f01b9641 (diff)
downloadqemu-ddaa6e049fc502fbd9cdaeb96d0c5e6c45878fb6.zip
qemu-ddaa6e049fc502fbd9cdaeb96d0c5e6c45878fb6.tar.gz
qemu-ddaa6e049fc502fbd9cdaeb96d0c5e6c45878fb6.tar.bz2
char/grlib_apbuart: Convert sysbus init function to realize function
Use DeviceClass rather than SysBusDeviceClass in grlib_apbuart_class_init(). Cc: chouteau@adacore.com Cc: marcandre.lureau@redhat.com Cc: pbonzini@redhat.com Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-id: 20181130093852.20739-4-maozhongyi@cmss.chinamobile.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/char/grlib_apbuart.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index bac11be..e1d258b 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -239,9 +239,10 @@ static const MemoryRegionOps grlib_apbuart_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int grlib_apbuart_init(SysBusDevice *dev)
+static void grlib_apbuart_realize(DeviceState *dev, Error **errp)
{
UART *uart = GRLIB_APB_UART(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
qemu_chr_fe_set_handlers(&uart->chr,
grlib_apbuart_can_receive,
@@ -249,14 +250,12 @@ static int grlib_apbuart_init(SysBusDevice *dev)
grlib_apbuart_event,
NULL, uart, NULL, true);
- sysbus_init_irq(dev, &uart->irq);
+ sysbus_init_irq(sbd, &uart->irq);
memory_region_init_io(&uart->iomem, OBJECT(uart), &grlib_apbuart_ops, uart,
"uart", UART_REG_SIZE);
- sysbus_init_mmio(dev, &uart->iomem);
-
- return 0;
+ sysbus_init_mmio(sbd, &uart->iomem);
}
static void grlib_apbuart_reset(DeviceState *d)
@@ -280,9 +279,8 @@ static Property grlib_apbuart_properties[] = {
static void grlib_apbuart_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = grlib_apbuart_init;
+ dc->realize = grlib_apbuart_realize;
dc->reset = grlib_apbuart_reset;
dc->props = grlib_apbuart_properties;
}