From 72da42085924f65c78e6ec478373f51a9e49e48d Mon Sep 17 00:00:00 2001 From: aliguori Date: Wed, 11 Feb 2009 15:19:52 +0000 Subject: qemu: return PCIDevice on net device init and record devfn (Marcelo Tosatti) Change the PCI network drivers init functions to return the PCIDev, to inform which slot has been hot-plugged. Also record PCIDevice structure on NICInfo to locate for release on hot-removal. Signed-off-by: Marcelo Tosatti Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6593 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/virtio-net.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'hw/virtio-net.c') diff --git a/hw/virtio-net.c b/hw/virtio-net.c index 62153e9..dcfab66 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -560,7 +560,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) return 0; } -void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) +PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) { VirtIONet *n; static int virtio_net_id; @@ -574,7 +574,7 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) sizeof(struct virtio_net_config), sizeof(VirtIONet)); if (!n) - return; + return NULL; n->vdev.get_config = virtio_net_get_config; n->vdev.set_config = virtio_net_set_config; @@ -599,12 +599,13 @@ void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn) n->mac_table.macs = qemu_mallocz(MAC_TABLE_ENTRIES * ETH_ALEN); if (!n->mac_table.macs) - return; + return NULL; n->vlans = qemu_mallocz(MAX_VLAN >> 3); if (!n->vlans) - return; + return NULL; register_savevm("virtio-net", virtio_net_id++, VIRTIO_NET_VM_VERSION, virtio_net_save, virtio_net_load, n); + return (PCIDevice *)n; } -- cgit v1.1