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>
This commit is contained in:
parent
8a502efd0c
commit
73a17349ff
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user