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>
This commit is contained in:
Peter Crosthwaite 2014-05-29 02:24:29 -07:00 committed by Edgar E. Iglesias
parent 8c6d96728d
commit e8198f6ea0

View File

@ -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), &eth_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, &eth_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,
};