diff options
Diffstat (limited to 'hw/net')
-rw-r--r-- | hw/net/xilinx_ethlite.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/hw/net/xilinx_ethlite.c b/hw/net/xilinx_ethlite.c index 6cbd95dde2..5a434f642d 100644 --- a/hw/net/xilinx_ethlite.c +++ b/hw/net/xilinx_ethlite.c @@ -226,22 +226,25 @@ static NetClientInfo net_xilinx_ethlite_info = { .cleanup = eth_cleanup, }; -static int xilinx_ethlite_init(SysBusDevice *sbd) +static void xilinx_ethlite_realize(DeviceState *dev, Error **errp) { - DeviceState *dev = DEVICE(sbd); struct xlx_ethlite *s = XILINX_ETHLITE(dev); - sysbus_init_irq(sbd, &s->irq); - - memory_region_init_io(&s->mmio, OBJECT(s), ð_ops, s, - "xlnx.xps-ethernetlite", R_MAX * 4); - sysbus_init_mmio(sbd, &s->mmio); - qemu_macaddr_default_if_unset(&s->conf.macaddr); s->nic = qemu_new_nic(&net_xilinx_ethlite_info, &s->conf, object_get_typename(OBJECT(dev)), dev->id, s); qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a); - return 0; +} + +static void xilinx_ethlite_init(Object *obj) +{ + struct xlx_ethlite *s = XILINX_ETHLITE(obj); + + sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq); + + memory_region_init_io(&s->mmio, obj, ð_ops, s, + "xlnx.xps-ethernetlite", R_MAX * 4); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio); } static Property xilinx_ethlite_properties[] = { @@ -254,9 +257,8 @@ static Property xilinx_ethlite_properties[] = { static void xilinx_ethlite_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = xilinx_ethlite_init; + dc->realize = xilinx_ethlite_realize; dc->reset = xilinx_ethlite_reset; dc->props = xilinx_ethlite_properties; } @@ -265,6 +267,7 @@ static const TypeInfo xilinx_ethlite_info = { .name = TYPE_XILINX_ETHLITE, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(struct xlx_ethlite), + .instance_init = xilinx_ethlite_init, .class_init = xilinx_ethlite_class_init, }; |