From 6f2b9a5b24c488d38ace01910c684749ff922e26 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Thu, 18 Jun 2015 17:45:47 +0200 Subject: 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 --- hw/input/virtio-input.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'hw/input') diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c index c4f4b3c150..7f5b8d6000 100644 --- a/hw/input/virtio-input.c +++ b/hw/input/virtio-input.c @@ -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; -- cgit v1.2.3