aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
authorKONRAD Frederic <fred.konrad@greensocs.com>2013-04-24 10:21:22 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-24 11:50:21 -0500
commit6a1a8cc7af5741a4221e1c5bc80c41390d896ff5 (patch)
tree39abf80dd8ff2dcf30563832304c01b027cd353e /hw/virtio
parent1c819449836b926d6f9db860127211ef092da88e (diff)
virtio: cleanup: init and exit function.
This clean the init and the exit functions and rename virtio_common_cleanup to virtio_cleanup. Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com> Message-id: 1366791683-5350-7-git-send-email-fred.konrad@greensocs.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/virtio-balloon.c4
-rw-r--r--hw/virtio/virtio-rng.c2
-rw-r--r--hw/virtio/virtio.c17
3 files changed, 4 insertions, 19 deletions
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 95fb3b06be..d669756a7f 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -348,7 +348,7 @@ static int virtio_balloon_device_init(VirtIODevice *vdev)
virtio_balloon_stat, s);
if (ret < 0) {
- virtio_common_cleanup(VIRTIO_DEVICE(s));
+ virtio_cleanup(VIRTIO_DEVICE(s));
return -1;
}
@@ -377,7 +377,7 @@ static int virtio_balloon_device_exit(DeviceState *qdev)
balloon_stats_destroy_timer(s);
qemu_remove_balloon_handler(s);
unregister_savevm(qdev, "virtio-balloon", s);
- virtio_common_cleanup(vdev);
+ virtio_cleanup(vdev);
return 0;
}
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 82d7a7436a..cb787c792d 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -192,7 +192,7 @@ static int virtio_rng_device_exit(DeviceState *qdev)
qemu_del_timer(vrng->rate_limit_timer);
qemu_free_timer(vrng->rate_limit_timer);
unregister_savevm(qdev, "virtio-rng", vrng);
- virtio_common_cleanup(vdev);
+ virtio_cleanup(vdev);
return 0;
}
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index e66dab114a..0f88c251c1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -910,19 +910,13 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
return 0;
}
-void virtio_common_cleanup(VirtIODevice *vdev)
+void virtio_cleanup(VirtIODevice *vdev)
{
qemu_del_vm_change_state_handler(vdev->vmstate);
g_free(vdev->config);
g_free(vdev->vq);
}
-void virtio_cleanup(VirtIODevice *vdev)
-{
- virtio_common_cleanup(vdev);
- g_free(vdev);
-}
-
static void virtio_vmstate_change(void *opaque, int running, RunState state)
{
VirtIODevice *vdev = opaque;
@@ -972,15 +966,6 @@ void virtio_init(VirtIODevice *vdev, const char *name,
vdev);
}
-VirtIODevice *virtio_common_init(const char *name, uint16_t device_id,
- size_t config_size, size_t struct_size)
-{
- VirtIODevice *vdev;
- vdev = g_malloc0(struct_size);
- virtio_init(vdev, name, device_id, config_size);
- return vdev;
-}
-
hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n)
{
return vdev->vq[n].vring.desc;