aboutsummaryrefslogtreecommitdiff
path: root/hw/spapr_vio.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-07 21:34:16 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-02-03 10:41:06 -0600
commit39bffca2030950ef6efe57c2fac8327a45ae1015 (patch)
tree325262f44978e6116c9e43f688c900e08ee83738 /hw/spapr_vio.c
parent212ad111683a5b5a79a74d6141a4b75f532a4c8f (diff)
qdev: register all types natively through QEMU Object Model
This was done in a mostly automated fashion. I did it in three steps and then rebased it into a single step which avoids repeatedly touching every file in the tree. The first step was a sed-based addition of the parent type to the subclass registration functions. The second step was another sed-based removal of subclass registration functions while also adding virtual functions from the base class into a class_init function as appropriate. Finally, a python script was used to convert the DeviceInfo structures and qdev_register_subclass functions to TypeInfo structures, class_init functions, and type_register_static calls. We are almost fully converted to QOM after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/spapr_vio.c')
-rw-r--r--hw/spapr_vio.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/hw/spapr_vio.c b/hw/spapr_vio.c
index dc2e9c910a..d39a47b11a 100644
--- a/hw/spapr_vio.c
+++ b/hw/spapr_vio.c
@@ -680,15 +680,6 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
return pc->init(dev);
}
-void spapr_vio_bus_register_withprop(DeviceInfo *info)
-{
- info->init = spapr_vio_busdev_init;
- info->bus_info = &spapr_vio_bus_info;
-
- assert(info->size >= sizeof(VIOsPAPRDevice));
- qdev_register_subclass(info, TYPE_VIO_SPAPR_DEVICE);
-}
-
static target_ulong h_vio_signal(CPUState *env, sPAPREnvironment *spapr,
target_ulong opcode,
target_ulong *args)
@@ -757,29 +748,39 @@ static int spapr_vio_bridge_init(SysBusDevice *dev)
static void spapr_vio_bridge_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sbc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- sbc->init = spapr_vio_bridge_init;
+ k->init = spapr_vio_bridge_init;
+ dc->no_user = 1;
}
-static DeviceInfo spapr_vio_bridge_info = {
- .name = "spapr-vio-bridge",
- .size = sizeof(SysBusDevice),
- .no_user = 1,
- .class_init = spapr_vio_bridge_class_init,
+static TypeInfo spapr_vio_bridge_info = {
+ .name = "spapr-vio-bridge",
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .instance_size = sizeof(SysBusDevice),
+ .class_init = spapr_vio_bridge_class_init,
};
+static void vio_spapr_device_class_init(ObjectClass *klass, void *data)
+{
+ DeviceClass *k = DEVICE_CLASS(klass);
+ k->init = spapr_vio_busdev_init;
+ k->bus_info = &spapr_vio_bus_info;
+}
+
static TypeInfo spapr_vio_type_info = {
.name = TYPE_VIO_SPAPR_DEVICE,
.parent = TYPE_DEVICE,
.instance_size = sizeof(VIOsPAPRDevice),
.abstract = true,
.class_size = sizeof(VIOsPAPRDeviceClass),
+ .class_init = vio_spapr_device_class_init,
};
static void spapr_vio_register_devices(void)
{
- sysbus_register_withprop(&spapr_vio_bridge_info);
+ type_register_static(&spapr_vio_bridge_info);
type_register_static(&spapr_vio_type_info);
}