[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [COMMIT a36a344] pci: use qdev for device destruction.
From: |
Anthony Liguori |
Subject: |
[Qemu-commits] [COMMIT a36a344] pci: use qdev for device destruction. |
Date: |
Mon, 05 Oct 2009 14:53:28 -0000 |
From: Gerd Hoffmann <address@hidden>
pci_unregister_device is static now and hooked into Devicestate->exit.
qdev_free(pci_device) works now.
Signed-off-by: Gerd Hoffmann <address@hidden>
Signed-off-by: Anthony Liguori <address@hidden>
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index 89974a0..7e39bdd 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -251,6 +251,6 @@ void pci_device_hot_remove_success(int pcibus, int slot)
break;
}
- pci_unregister_device(d);
+ qdev_free(&d->qdev);
}
diff --git a/hw/pci.c b/hw/pci.c
index eb8d0f1..0c7d7ec 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -399,8 +399,9 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)
}
}
-int pci_unregister_device(PCIDevice *pci_dev)
+static int pci_unregister_device(DeviceState *dev)
{
+ PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
int ret = 0;
if (pci_dev->unregister)
@@ -412,7 +413,6 @@ int pci_unregister_device(PCIDevice *pci_dev)
qemu_free_irqs(pci_dev->irq);
pci_dev->bus->devices[pci_dev->devfn] = NULL;
- qdev_free(&pci_dev->qdev);
return 0;
}
@@ -956,6 +956,7 @@ static int pci_qdev_init(DeviceState *qdev, DeviceInfo
*base)
void pci_qdev_register(PCIDeviceInfo *info)
{
info->qdev.init = pci_qdev_init;
+ info->qdev.exit = pci_unregister_device;
info->qdev.bus_info = &pci_bus_info;
qdev_register(&info->qdev);
}
diff --git a/hw/pci.h b/hw/pci.h
index c5c8c57..9233b5b 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -185,7 +185,6 @@ struct PCIDevice {
/* do not access the following fields */
PCIConfigReadFunc *config_read;
PCIConfigWriteFunc *config_write;
- PCIUnregisterFunc *unregister;
/* IRQ objects for the INTA-INTD pins. */
qemu_irq *irq;
@@ -224,7 +223,6 @@ PCIDevice *pci_register_device(PCIBus *bus, const char
*name,
int instance_size, int devfn,
PCIConfigReadFunc *config_read,
PCIConfigWriteFunc *config_write);
-int pci_unregister_device(PCIDevice *pci_dev);
void pci_register_bar(PCIDevice *pci_dev, int region_num,
uint32_t size, int type,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-commits] [COMMIT a36a344] pci: use qdev for device destruction.,
Anthony Liguori <=