hw/ppc: QOM'ify ppce500_spin.c
Drop the old SysBus init function and use instance_init Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
d0c2b0d089
commit
09a7eb978f
@ -54,9 +54,9 @@ typedef struct SpinState {
|
||||
SpinInfo spin[MAX_CPUS];
|
||||
} SpinState;
|
||||
|
||||
static void spin_reset(void *opaque)
|
||||
static void spin_reset(DeviceState *dev)
|
||||
{
|
||||
SpinState *s = opaque;
|
||||
SpinState *s = E500_SPIN(dev);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_CPUS; i++) {
|
||||
@ -174,30 +174,28 @@ static const MemoryRegionOps spin_rw_ops = {
|
||||
.endianness = DEVICE_BIG_ENDIAN,
|
||||
};
|
||||
|
||||
static int ppce500_spin_initfn(SysBusDevice *dev)
|
||||
static void ppce500_spin_initfn(Object *obj)
|
||||
{
|
||||
SysBusDevice *dev = SYS_BUS_DEVICE(obj);
|
||||
SpinState *s = E500_SPIN(dev);
|
||||
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &spin_rw_ops, s,
|
||||
memory_region_init_io(&s->iomem, obj, &spin_rw_ops, s,
|
||||
"e500 spin pv device", sizeof(SpinInfo) * MAX_CPUS);
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
|
||||
qemu_register_reset(spin_reset, s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void ppce500_spin_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
k->init = ppce500_spin_initfn;
|
||||
dc->reset = spin_reset;
|
||||
}
|
||||
|
||||
static const TypeInfo ppce500_spin_info = {
|
||||
.name = TYPE_E500_SPIN,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(SpinState),
|
||||
.instance_init = ppce500_spin_initfn,
|
||||
.class_init = ppce500_spin_class_init,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user