diff options
author | Peter Crosthwaite <peter.crosthwaite@xilinx.com> | 2014-05-29 02:24:29 -0700 |
---|---|---|
committer | Edgar E. Iglesias <edgar.iglesias@gmail.com> | 2014-06-09 00:33:03 +0200 |
commit | e8198f6ea0d7770bd7418d4389f3f5df4a5be074 (patch) | |
tree | c7ac139b4aa27ca94db19fece0549a331cdefdbf /hw/net/xilinx_ethlite.c | |
parent | 8c6d96728d54891b1d6f7a4183e1a657be68be36 (diff) | |
download | qemu-e8198f6ea0d7770bd7418d4389f3f5df4a5be074.zip |
net: xilinx_ethlite: 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/net/xilinx_ethlite.c')
-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, }; |