Received: from eggs.gnu.org ([2001:4830:134:3::10]:37308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btQn9-0003Nn-7N for qemu-devel@nongnu.org; Sun, 09 Oct 2016 22:58:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btQn6-0003bO-T8 for qemu-devel@nongnu.org; Sun, 09 Oct 2016 22:58:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btQn6-0003ao-Mj for qemu-devel@nongnu.org; Sun, 09 Oct 2016 22:58:12 -0400 Date: Mon, 10 Oct 2016 05:58:11 +0300 From: "Michael S. Tsirkin" Message-ID: <1476057841-21108-28-git-send-email-mst@redhat.com> References: <1476057841-21108-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1476057841-21108-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 27/33] virtio-input: convert VMSTATE_VIRTIO_DEVICE List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Halil Pasic , Gerd Hoffmann From: Halil Pasic Use the new VMSTATE_VIRTIO_DEVICE macro. Signed-off-by: Halil Pasic Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/input/virtio-input.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/hw/input/virtio-input.c b/hw/input/virtio-input.c index ccdf730..5e31033 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), -- MST