mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
virtio-input: move properties, use virtio_instance_init_common
Move properties from virtio-*-pci to virtio-*-device. Also make better use of QOM and attach common properties to the abstract parent classes (virtio-input-device and virtio-input-pci-device). Switch the hid device instance init functions over to use virtio_instance_init_common, so we get the properties of the virtio device aliased properly to the virtio pci proxy. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
0c8ff723bd
commit
6f2b9a5b24
3 changed files with 19 additions and 25 deletions
|
@ -216,7 +216,7 @@ static void virtio_input_device_realize(DeviceState *dev, Error **errp)
|
|||
}
|
||||
|
||||
virtio_input_idstr_config(vinput, VIRTIO_INPUT_CFG_ID_SERIAL,
|
||||
vinput->input.serial);
|
||||
vinput->serial);
|
||||
|
||||
QTAILQ_FOREACH(cfg, &vinput->cfg_list, node) {
|
||||
if (vinput->cfg_size < cfg->config.size) {
|
||||
|
@ -248,11 +248,17 @@ static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
|
|||
virtio_cleanup(vdev);
|
||||
}
|
||||
|
||||
static Property virtio_input_properties[] = {
|
||||
DEFINE_PROP_STRING("serial", VirtIOInput, serial),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void virtio_input_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||
|
||||
dc->props = virtio_input_properties;
|
||||
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
|
||||
vdc->realize = virtio_input_device_realize;
|
||||
vdc->unrealize = virtio_input_device_unrealize;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue