diff options
author | xiaoqiang zhao <zxq_yx_007@163.com> | 2017-05-25 21:34:51 +0800 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2017-06-02 05:54:43 +0100 |
commit | 78fb261db18d3e12f68304c0d91a85e0a3bbc757 (patch) | |
tree | 32f3219800f56a9b2ae60a63b6bc7a55fe430e7e /hw/sparc64 | |
parent | dc8b6dd98458ffc6d93b110ab7406301e911c6db (diff) | |
download | qemu-78fb261db18d3e12f68304c0d91a85e0a3bbc757.zip qemu-78fb261db18d3e12f68304c0d91a85e0a3bbc757.tar.gz qemu-78fb261db18d3e12f68304c0d91a85e0a3bbc757.tar.bz2 |
hw/sparc64: QOM'ify sun4u.c
Drop the old SysBusDeviceClass::init and use instance_init
or DeviceClass::realize instead
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/sparc64')
-rw-r--r-- | hw/sparc64/sun4u.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c index d347b66..18b8f8b 100644 --- a/hw/sparc64/sun4u.c +++ b/hw/sparc64/sun4u.c @@ -329,16 +329,16 @@ static void prom_init(hwaddr addr, const char *bios_name) } } -static int prom_init1(SysBusDevice *dev) +static void prom_init1(Object *obj) { - PROMState *s = OPENPROM(dev); + PROMState *s = OPENPROM(obj); + SysBusDevice *dev = SYS_BUS_DEVICE(obj); - memory_region_init_ram(&s->prom, OBJECT(s), "sun4u.prom", PROM_SIZE_MAX, + memory_region_init_ram(&s->prom, obj, "sun4u.prom", PROM_SIZE_MAX, &error_fatal); vmstate_register_ram_global(&s->prom); memory_region_set_readonly(&s->prom, true); sysbus_init_mmio(dev, &s->prom); - return 0; } static Property prom_properties[] = { @@ -348,9 +348,7 @@ static Property prom_properties[] = { static void prom_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = prom_init1; dc->props = prom_properties; } @@ -359,6 +357,7 @@ static const TypeInfo prom_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(PROMState), .class_init = prom_class_init, + .instance_init = prom_init1, }; @@ -373,15 +372,15 @@ typedef struct RamDevice { } RamDevice; /* System RAM */ -static int ram_init1(SysBusDevice *dev) +static void ram_realize(DeviceState *dev, Error **errp) { RamDevice *d = SUN4U_RAM(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); memory_region_init_ram(&d->ram, OBJECT(d), "sun4u.ram", d->size, &error_fatal); vmstate_register_ram_global(&d->ram); - sysbus_init_mmio(dev, &d->ram); - return 0; + sysbus_init_mmio(sbd, &d->ram); } static void ram_init(hwaddr addr, ram_addr_t RAM_size) @@ -409,9 +408,8 @@ static Property ram_properties[] = { static void ram_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = ram_init1; + dc->realize = ram_realize; dc->props = ram_properties; } |