Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- hw/ide/ahci.c | 2 +- hw/ide/ahci.h | 2 +- hw/ide/ich.c | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c index 6b87549..083e0f4 100644 --- a/hw/ide/ahci.c +++ b/hw/ide/ahci.c @@ -1174,7 +1174,7 @@ void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports) } } -void ahci_uninit(AHCIState *s) +void ahci_instance_finalize(AHCIState *s) { memory_region_destroy(&s->mem); memory_region_destroy(&s->idp); diff --git a/hw/ide/ahci.h b/hw/ide/ahci.h index 341a571..b2197c2 100644 --- a/hw/ide/ahci.h +++ b/hw/ide/ahci.h @@ -339,7 +339,7 @@ typedef struct NCQFrame { } QEMU_PACKED NCQFrame; void ahci_init(AHCIState *s, DeviceState *qdev, AddressSpace *as, int ports); -void ahci_uninit(AHCIState *s); +void ahci_instance_finalize(AHCIState *s); void ahci_reset(AHCIState *s); diff --git a/hw/ide/ich.c b/hw/ide/ich.c index 6c0c0c2..7c8c672 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -140,11 +140,15 @@ static int pci_ich9_ahci_init(PCIDevice *dev) static void pci_ich9_uninit(PCIDevice *dev) { - struct AHCIPCIState *d; - d = DO_UPCAST(struct AHCIPCIState, card, dev); - msi_uninit(dev); - ahci_uninit(&d->ahci); +} + +static void pci_ich9_instance_finalize(Object *obj) +{ + PCIDevice *dev = PCI_DEVICE(obj); + struct AHCIPCIState *d = DO_UPCAST(struct AHCIPCIState, card, dev); + + ahci_instance_finalize(&d->ahci); } static void ich_ahci_class_init(ObjectClass *klass, void *data) @@ -167,6 +171,7 @@ static const TypeInfo ich_ahci_info = { .parent = TYPE_PCI_DEVICE, .instance_size = sizeof(AHCIPCIState), .class_init = ich_ahci_class_init, + .instance_finalize = pci_ich9_instance_finalize, }; static void ich_ahci_register_types(void) -- 1.8.1.4