aboutsummaryrefslogtreecommitdiff
path: root/hw/intc/lm32_pic.c
diff options
context:
space:
mode:
authorxiaoqiang zhao <zxq_yx_007@163.com>2016-03-30 18:09:27 +0800
committerMichael Walle <michael@walle.cc>2016-06-20 18:12:04 +0200
commit5e502d31db1d6759baa36f765775294a2b16991e (patch)
treeabe6177e60f8add8b058110938b3fb6d77bf4570 /hw/intc/lm32_pic.c
parent165b244b98923ad94898a693f08d77423176080c (diff)
hw/intc: QOM'ify lm32_pic.c
Drop the old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Acked-by: Michael Walle <michael@walle.cc> Tested-by: Michael Walle <michael@walle.cc> Signed-off-by: Michael Walle <michael@walle.cc>
Diffstat (limited to 'hw/intc/lm32_pic.c')
-rw-r--r--hw/intc/lm32_pic.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/intc/lm32_pic.c b/hw/intc/lm32_pic.c
index edc08f184a..3dad01c5ba 100644
--- a/hw/intc/lm32_pic.c
+++ b/hw/intc/lm32_pic.c
@@ -152,17 +152,16 @@ static void pic_reset(DeviceState *d)
}
}
-static int lm32_pic_init(SysBusDevice *sbd)
+static void lm32_pic_init(Object *obj)
{
- DeviceState *dev = DEVICE(sbd);
- LM32PicState *s = LM32_PIC(dev);
+ DeviceState *dev = DEVICE(obj);
+ LM32PicState *s = LM32_PIC(obj);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
qdev_init_gpio_in(dev, irq_handler, 32);
sysbus_init_irq(sbd, &s->parent_irq);
pic = s;
-
- return 0;
}
static const VMStateDescription vmstate_lm32_pic = {
@@ -181,9 +180,7 @@ static const VMStateDescription vmstate_lm32_pic = {
static void lm32_pic_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = lm32_pic_init;
dc->reset = pic_reset;
dc->vmsd = &vmstate_lm32_pic;
}
@@ -192,6 +189,7 @@ static const TypeInfo lm32_pic_info = {
.name = TYPE_LM32_PIC,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(LM32PicState),
+ .instance_init = lm32_pic_init,
.class_init = lm32_pic_class_init,
};