mirror of
https://github.com/qemu/qemu.git
synced 2024-11-28 14:24:02 +08:00
timer: xilinx_timer: 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:
parent
50809c8b92
commit
04bb4d86f1
@ -204,14 +204,11 @@ static void timer_hit(void *opaque)
|
||||
timer_update_irq(t);
|
||||
}
|
||||
|
||||
static int xilinx_timer_init(SysBusDevice *dev)
|
||||
static void xilinx_timer_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
struct timerblock *t = XILINX_TIMER(dev);
|
||||
unsigned int i;
|
||||
|
||||
/* All timers share a single irq line. */
|
||||
sysbus_init_irq(dev, &t->irq);
|
||||
|
||||
/* Init all the ptimers. */
|
||||
t->timers = g_malloc0(sizeof t->timers[0] * num_timers(t));
|
||||
for (i = 0; i < num_timers(t); i++) {
|
||||
@ -226,8 +223,15 @@ static int xilinx_timer_init(SysBusDevice *dev)
|
||||
|
||||
memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t, "xlnx.xps-timer",
|
||||
R_MAX * 4 * num_timers(t));
|
||||
sysbus_init_mmio(dev, &t->mmio);
|
||||
return 0;
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &t->mmio);
|
||||
}
|
||||
|
||||
static void xilinx_timer_init(Object *obj)
|
||||
{
|
||||
struct timerblock *t = XILINX_TIMER(obj);
|
||||
|
||||
/* All timers share a single irq line. */
|
||||
sysbus_init_irq(SYS_BUS_DEVICE(obj), &t->irq);
|
||||
}
|
||||
|
||||
static Property xilinx_timer_properties[] = {
|
||||
@ -240,9 +244,8 @@ static Property xilinx_timer_properties[] = {
|
||||
static void xilinx_timer_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = xilinx_timer_init;
|
||||
dc->realize = xilinx_timer_realize;
|
||||
dc->props = xilinx_timer_properties;
|
||||
}
|
||||
|
||||
@ -250,6 +253,7 @@ static const TypeInfo xilinx_timer_info = {
|
||||
.name = TYPE_XILINX_TIMER,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(struct timerblock),
|
||||
.instance_init = xilinx_timer_init,
|
||||
.class_init = xilinx_timer_class_init,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user