aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2014-05-29 02:23:20 -0700
committerEdgar E. Iglesias <edgar.iglesias@gmail.com>2014-06-09 00:33:02 +0200
commit04bb4d86f116b07cede742bee534b002735829d6 (patch)
tree8e3a631f7a65d84d5ef8198db7989630868efefe
parent50809c8b9288a9bfe1fdec926b7ef985608a7ea6 (diff)
downloadqemu-04bb4d86f116b07cede742bee534b002735829d6.zip
qemu-04bb4d86f116b07cede742bee534b002735829d6.tar.gz
qemu-04bb4d86f116b07cede742bee534b002735829d6.tar.bz2
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>
-rw-r--r--hw/timer/xilinx_timer.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/hw/timer/xilinx_timer.c b/hw/timer/xilinx_timer.c
index 3ff1da9..cdb3355 100644
--- a/hw/timer/xilinx_timer.c
+++ b/hw/timer/xilinx_timer.c
@@ -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,
};