diff options
author | Anthony Liguori | 2011-12-08 04:34:16 +0100 |
---|---|---|
committer | Anthony Liguori | 2012-02-03 17:41:06 +0100 |
commit | 39bffca2030950ef6efe57c2fac8327a45ae1015 (patch) | |
tree | 325262f44978e6116c9e43f688c900e08ee83738 /hw/usb-audio.c | |
parent | qdev: kill off DeviceInfo list (diff) | |
download | qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.gz qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.tar.xz qemu-39bffca2030950ef6efe57c2fac8327a45ae1015.zip |
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/usb-audio.c')
-rw-r--r-- | hw/usb-audio.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/hw/usb-audio.c b/hw/usb-audio.c index 459f162041..cd589b718a 100644 --- a/hw/usb-audio.c +++ b/hw/usb-audio.c @@ -674,10 +674,20 @@ static const VMStateDescription vmstate_usb_audio = { .unmigratable = 1, }; +static Property usb_audio_properties[] = { + DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0), + DEFINE_PROP_UINT32("buffer", USBAudioState, buffer, + 8 * USBAUDIO_PACKET_SIZE), + DEFINE_PROP_END_OF_LIST(), +}; + static void usb_audio_class_init(ObjectClass *klass, void *data) { + DeviceClass *dc = DEVICE_CLASS(klass); USBDeviceClass *k = USB_DEVICE_CLASS(klass); + dc->vmsd = &vmstate_usb_audio; + dc->props = usb_audio_properties; k->product_desc = "QEMU USB Audio Interface"; k->usb_desc = &desc_audio; k->init = usb_audio_initfn; @@ -689,22 +699,16 @@ static void usb_audio_class_init(ObjectClass *klass, void *data) k->set_interface = usb_audio_set_interface; } -static struct DeviceInfo usb_audio_info = { - .name = "usb-audio", - .size = sizeof(USBAudioState), - .vmsd = &vmstate_usb_audio, - .class_init = usb_audio_class_init, - .props = (Property[]) { - DEFINE_PROP_UINT32("debug", USBAudioState, debug, 0), - DEFINE_PROP_UINT32("buffer", USBAudioState, buffer, - 8 * USBAUDIO_PACKET_SIZE), - DEFINE_PROP_END_OF_LIST(), - } +static TypeInfo usb_audio_info = { + .name = "usb-audio", + .parent = TYPE_USB_DEVICE, + .instance_size = sizeof(USBAudioState), + .class_init = usb_audio_class_init, }; static void usb_audio_register_devices(void) { - usb_qdev_register(&usb_audio_info); + type_register_static(&usb_audio_info); usb_legacy_register("usb-audio", "audio", NULL); } |