aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio-balloon.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-14 22:35:08 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-14 22:35:08 +0100
commit2d72c5727f8343a39862b8fca3b53a2bce26a7ca (patch)
tree2665a90d4825e29d4b52e7a564c071bd63330cd9 /hw/virtio-balloon.c
parent07e3af9ac31008a1d7eaaf44d62a13545f01c579 (diff)
Virtio-balloon qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/virtio-balloon.c')
-rw-r--r--hw/virtio-balloon.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/hw/virtio-balloon.c b/hw/virtio-balloon.c
index b8f9184e11..7fa7e47f7f 100644
--- a/hw/virtio-balloon.c
+++ b/hw/virtio-balloon.c
@@ -169,17 +169,11 @@ static int virtio_balloon_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-void *virtio_balloon_init(PCIBus *bus)
+static void virtio_balloon_init(PCIDevice *pci_dev)
{
VirtIOBalloon *s;
- PCIDevice *d;
- d = pci_register_device(bus, "virtio-balloon", sizeof(VirtIOBalloon),
- -1, NULL, NULL);
- if (!d)
- return NULL;
-
- s = (VirtIOBalloon *)virtio_init_pci(d, "virtio-balloon",
+ s = (VirtIOBalloon *)virtio_init_pci(pci_dev, "virtio-balloon",
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_BALLOON,
PCI_VENDOR_ID_REDHAT_QUMRANET,
@@ -197,6 +191,12 @@ void *virtio_balloon_init(PCIBus *bus)
qemu_add_balloon_handler(virtio_balloon_to_target, s);
register_savevm("virtio-balloon", -1, 1, virtio_balloon_save, virtio_balloon_load, s);
+}
- return &s->vdev;
+static void virtio_balloon_register_devices(void)
+{
+ pci_qdev_register("virtio-balloon", sizeof(VirtIOBalloon),
+ virtio_balloon_init);
}
+
+device_init(virtio_balloon_register_devices)