From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53804) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMn-0000Nr-W9 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjwMn-0007t7-93 for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:57 -0400 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:57665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMn-0007sv-2F for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:57 -0400 Received: by mail-wi0-f182.google.com with SMTP id c10so531477wiw.15 for ; Tue, 04 Jun 2013 11:53:56 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 4 Jun 2013 20:52:31 +0200 Message-Id: <1370371954-8479-37-git-send-email-pbonzini@redhat.com> In-Reply-To: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> References: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 36/39] virtio-pci: split exit and instance_finalize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com Signed-off-by: Paolo Bonzini --- hw/virtio/virtio-pci.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index cbfec6b..61f4dcb 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -996,8 +996,14 @@ static void virtio_pci_exit(PCIDevice *pci_dev) { VirtIOPCIProxy *proxy = VIRTIO_PCI(pci_dev); virtio_pci_stop_ioeventfd(proxy); - memory_region_destroy(&proxy->bar); msix_uninit_exclusive_bar(pci_dev); +} + +static void virtio_pci_instance_finalize(Object *obj) +{ + PCIDevice *pci_dev = PCI_DEVICE(obj); + VirtIOPCIProxy *proxy = VIRTIO_PCI(obj); + memory_region_destroy(&proxy->bar); msix_free(pci_dev); } @@ -1030,6 +1036,7 @@ static const TypeInfo virtio_pci_info = { .instance_size = sizeof(VirtIOPCIProxy), .class_init = virtio_pci_class_init, .class_size = sizeof(VirtioPCIClass), + .instance_finalize = virtio_pci_instance_finalize, .abstract = true, }; -- 1.8.1.4