[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/24] pci: use qdev for device destruction.
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 12/24] pci: use qdev for device destruction. |
Date: |
Fri, 25 Sep 2009 21:42:37 +0200 |
pci_unregister_device is static now and hooked into Devicestate->exit.
qdev_free(pci_device) works now.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/pci-hotplug.c | 2 +-
hw/pci.c | 5 +++--
hw/pci.h | 2 --
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c
index f3dc421..255decd 100644
--- a/hw/pci-hotplug.c
+++ b/hw/pci-hotplug.c
@@ -247,6 +247,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 608792a..a6cd630 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;
}
@@ -945,6 +945,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 2b6a0f2..0ba7e6c 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,
--
1.6.2.5
- [Qemu-devel] [PATCH 00/24] qdev: bus management updates., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 01/24] unbreak usb pass-through on linux., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 05/24] switch ide bus to inplace allocation., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 04/24] switch usb bus to inplace allocation., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 03/24] switch scsi bus to inplace allocation., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 06/24] inplace allocation for pci, split irq init., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 02/24] allow qdev busses allocations be inplace, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 08/24] piix_pci: kill PIIX3IrqState, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 10/24] Add exit callback to DeviceInfo., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 12/24] pci: use qdev for device destruction.,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 07/24] convert pci bridge to qdev, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 13/24] pci: move unregister from PCIDevice to PCIDeviceInfo, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 11/24] Implement scsi device destruction, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 09/24] qdev: device free fixups., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 14/24] usb: hook unplug into qdev, cleanups + fixes., Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 17/24] usb: hotplug windup, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 23/24] allow if=none for drive_add, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 19/24] pci: hotplug windup, Gerd Hoffmann, 2009/09/25
- [Qemu-devel] [PATCH 15/24] switch qemu-config to qemu_error, Gerd Hoffmann, 2009/09/25