diff mbox

[07/12] virtio-input: convert to VIRTIO_DEF_DEVICE_VMSD

Message ID 20160930142003.53232-8-pasic@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Halil Pasic Sept. 30, 2016, 2:19 p.m. UTC
Refactor so the previously introduced VIRTIO_DEF_DEVICE_VMSD
replaces VMSTATE_VIRTIO_DEVICE.

Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com>
---
 hw/input/virtio-input.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c
index ccdf730..d8509fa 100644
--- a/hw/input/virtio-input.c
+++ b/hw/input/virtio-input.c
@@ -217,19 +217,12 @@  static void virtio_input_reset(VirtIODevice *vdev)
     }
 }
 
-static int virtio_input_load(QEMUFile *f, void *opaque, size_t size)
+static int virtio_input_post_load(void *opaque, int version_id)
 {
     VirtIOInput *vinput = opaque;
     VirtIOInputClass *vic = VIRTIO_INPUT_GET_CLASS(vinput);
     VirtIODevice *vdev = VIRTIO_DEVICE(vinput);
-    int ret;
 
-    ret = virtio_load(vdev, f, VIRTIO_INPUT_VM_VERSION);
-    if (ret) {
-        return ret;
-    }
-
-    /* post_load() */
     vinput->active = vdev->status & VIRTIO_CONFIG_S_DRIVER_OK;
     if (vic->change_active) {
         vic->change_active(vinput);
@@ -296,8 +289,8 @@  static void virtio_input_device_unrealize(DeviceState *dev, Error **errp)
     virtio_cleanup(vdev);
 }
 
-VMSTATE_VIRTIO_DEVICE(input, VIRTIO_INPUT_VM_VERSION, virtio_input_load,
-                      virtio_vmstate_save);
+VIRTIO_DEF_DEVICE_VMSD(input, VIRTIO_INPUT_VM_VERSION,
+    .post_load = virtio_input_post_load)
 
 static Property virtio_input_properties[] = {
     DEFINE_PROP_STRING("serial", VirtIOInput, serial),