Patchwork [34/39] pvscsi: split exit and instance_finalize

login
register
mail settings
Submitter Paolo Bonzini
Date June 4, 2013, 6:52 p.m.
Message ID <1370371954-8479-35-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/248829/
State New
Headers show

Comments

Paolo Bonzini - June 4, 2013, 6:52 p.m.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/scsi/vmw_pvscsi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

Patch

diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index eb2270f..5e97555 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1100,9 +1100,18 @@  pvscsi_uninit(PCIDevice *pci_dev)
     PVSCSIState *s = PVSCSI(pci_dev);
 
     trace_pvscsi_state("uninit");
-    qemu_bh_delete(s->completion_worker);
 
     pvscsi_cleanup_msi(s);
+}
+
+static void 
+pvscsi_instance_finalize(Object *obj)
+{
+    PVSCSIState *s = PVSCSI(obj);
+
+    trace_pvscsi_state("finalize");
+
+    qemu_bh_delete(s->completion_worker);
 
     memory_region_destroy(&s->io_space);
 }
@@ -1205,6 +1214,7 @@  static const TypeInfo pvscsi_info = {
     .parent        = TYPE_PCI_DEVICE,
     .instance_size = sizeof(PVSCSIState),
     .class_init    = pvscsi_class_init,
+    .instance_finalize = pvscsi_instance_finalize,
 };
 
 static void