Patchwork [14/41] virtio: remove save/load_config for virtio

login
register
mail settings
Submitter Juan Quintela
Date Dec. 2, 2009, 12:04 p.m.
Message ID <6d1a6e215c12f5b9a4ff2e09f7e20919baf05176.1259754427.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/40019/
State New
Headers show

Comments

Juan Quintela - Dec. 2, 2009, 12:04 p.m.
It was used only for PCI virtio devices, state that

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/virtio-pci.c |   13 -------------
 hw/virtio.c     |    9 +++++----
 hw/virtio.h     |    5 +++--
 3 files changed, 8 insertions(+), 19 deletions(-)

Patch

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 4fe55aa..45d0adc 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -151,17 +151,6 @@  const VMStateDescription vmstate_virtio_pci_config = {
     }
 };

-static void virtio_pci_save_config(void * opaque, QEMUFile *f)
-{
-    vmstate_save_state(f, &vmstate_virtio_pci_config, opaque);
-}
-
-static int virtio_pci_load_config(void * opaque, QEMUFile *f)
-{
-    return vmstate_load_state(f, &vmstate_virtio_pci_config, opaque,
-                              vmstate_virtio_pci_config.version_id);
-}
-
 static void virtio_pci_save_queue(void * opaque, int n, QEMUFile *f)
 {
     VirtIOPCIProxy *proxy = opaque;
@@ -413,8 +402,6 @@  static void virtio_write_config(PCIDevice *pci_dev, uint32_t address,

 static const VirtIOBindings virtio_pci_bindings = {
     .notify = virtio_pci_notify,
-    .save_config = virtio_pci_save_config,
-    .load_config = virtio_pci_load_config,
     .save_queue = virtio_pci_save_queue,
     .load_queue = virtio_pci_load_queue,
 };
diff --git a/hw/virtio.c b/hw/virtio.c
index 1f92171..c136005 100644
--- a/hw/virtio.c
+++ b/hw/virtio.c
@@ -619,8 +619,8 @@  void virtio_save(VirtIODevice *vdev, QEMUFile *f)
 {
     int i;

-    if (vdev->binding->save_config)
-        vdev->binding->save_config(vdev->binding_opaque, f);
+    if (vdev->type == VIRTIO_PCI)
+        vmstate_save_state(f, &vmstate_virtio_pci_config, vdev->binding_opaque);

     qemu_put_8s(f, &vdev->status);
     qemu_put_8s(f, &vdev->isr);
@@ -652,8 +652,9 @@  int virtio_load(VirtIODevice *vdev, QEMUFile *f)
 {
     int num, i, ret;

-    if (vdev->binding->load_config) {
-        ret = vdev->binding->load_config(vdev->binding_opaque, f);
+    if (vdev->type == VIRTIO_PCI) {
+        ret = vmstate_load_state(f, &vmstate_virtio_pci_config, vdev->binding_opaque,
+                                 vmstate_virtio_pci_config.version_id);
         if (ret)
             return ret;
     }
diff --git a/hw/virtio.h b/hw/virtio.h
index ec1ff4d..9d2e2cc 100644
--- a/hw/virtio.h
+++ b/hw/virtio.h
@@ -78,9 +78,7 @@  typedef struct VirtQueueElement

 typedef struct {
     void (*notify)(void * opaque, uint16_t vector);
-    void (*save_config)(void * opaque, QEMUFile *f);
     void (*save_queue)(void * opaque, int n, QEMUFile *f);
-    int (*load_config)(void * opaque, QEMUFile *f);
     int (*load_queue)(void * opaque, int n, QEMUFile *f);
 } VirtIOBindings;

@@ -176,4 +174,7 @@  VirtIODevice *virtio_balloon_init(DeviceState *dev);

 void virtio_net_exit(VirtIODevice *vdev);

+/* virtio-pci. */
+extern const VMStateDescription vmstate_virtio_pci_config;
+
 #endif