aboutsummaryrefslogtreecommitdiff
path: root/hw/input/virtio-input.c
diff options
context:
space:
mode:
authorHalil Pasic <pasic@linux.vnet.ibm.com>2016-10-06 14:55:45 +0200
committerMichael S. Tsirkin <mst@redhat.com>2016-10-10 02:21:43 +0300
commit73a17349ffa5dd6dec0947ecb09c657becb2f6e5 (patch)
tree59fc6699254cb86eaf11985f7124fe2d46315e77 /hw/input/virtio-input.c
parent8a502efd0c4beb0bdd7fbcf67cc722db00eddca1 (diff)
virtio-input: convert VMSTATE_VIRTIO_DEVICE
Use the new VMSTATE_VIRTIO_DEVICE macro. Signed-off-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/input/virtio-input.c')
-rw-r--r--hw/input/virtio-input.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c
index ccdf7308a5..5e31033c4d 100644
--- a/hw/input/virtio-input.c
+++ b/hw/input/virtio-input.c
@@ -4,6 +4,8 @@
* top-level directory.
*/
+#define VMSTATE_VIRTIO_DEVICE_USE_NEW
+
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/iov.h"
@@ -217,19 +219,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 +291,16 @@ 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);
+static const VMStateDescription vmstate_virtio_input = {
+ .name = "virtio-input",
+ .minimum_version_id = VIRTIO_INPUT_VM_VERSION,
+ .version_id = VIRTIO_INPUT_VM_VERSION,
+ .fields = (VMStateField[]) {
+ VMSTATE_VIRTIO_DEVICE,
+ VMSTATE_END_OF_LIST()
+ },
+ .post_load = virtio_input_post_load,
+};
static Property virtio_input_properties[] = {
DEFINE_PROP_STRING("serial", VirtIOInput, serial),