diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-05-02 09:00:20 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-06-18 15:14:38 +0200 |
commit | 0d936928ef87ca1bb7b41b5b89c400c699a7691c (patch) | |
tree | 134a900379f06e1e84f31728a866d8afc7e9869a /hw/intel-hda.c | |
parent | 8185d21639ab749979445734ec671122aa96e805 (diff) |
qdev: Convert busses to QEMU Object Model
This is far less interesting than it sounds. We simply add an Object to each
BusState and then register the types appropriately. Most of the interesting
refactoring will follow in the next patches.
Since we're changing fundamental type names (BusInfo -> BusClass), it all needs
to convert at once. Fortunately, not a lot of code is affected.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Made all new bus TypeInfos static const.]
[AF: Made qbus_free() call object_delete(), required {qom,glib}_allocated]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/intel-hda.c')
-rw-r--r-- | hw/intel-hda.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hw/intel-hda.c b/hw/intel-hda.c index e2bd41eb66..e343096534 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -34,16 +34,17 @@ static Property hda_props[] = { DEFINE_PROP_END_OF_LIST() }; -static struct BusInfo hda_codec_bus_info = { - .name = "HDA", - .size = sizeof(HDACodecBus), +static const TypeInfo hda_codec_bus_info = { + .name = TYPE_HDA_BUS, + .parent = TYPE_BUS, + .instance_size = sizeof(HDACodecBus), }; void hda_codec_bus_init(DeviceState *dev, HDACodecBus *bus, hda_codec_response_func response, hda_codec_xfer_func xfer) { - qbus_create_inplace(&bus->qbus, &hda_codec_bus_info, dev, NULL); + qbus_create_inplace(&bus->qbus, TYPE_HDA_BUS, dev, NULL); bus->response = response; bus->xfer = xfer; } @@ -1276,7 +1277,7 @@ static void hda_codec_device_class_init(ObjectClass *klass, void *data) DeviceClass *k = DEVICE_CLASS(klass); k->init = hda_codec_dev_init; k->exit = hda_codec_dev_exit; - k->bus_info = &hda_codec_bus_info; + k->bus_type = TYPE_HDA_BUS; k->props = hda_props; } @@ -1291,6 +1292,7 @@ static TypeInfo hda_codec_device_type_info = { static void intel_hda_register_types(void) { + type_register_static(&hda_codec_bus_info); type_register_static(&intel_hda_info); type_register_static(&hda_codec_device_type_info); } |