summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-09-25 21:42:38 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:48 -0500
commite3936fa574d9fbe241acdc76b5195b048567537e (patch)
tree51832bf75d2c7677e08e833ce71921cde22ccb9b /hw
parenta36a344dcd5c778cc0417df36c5aa8f95c5497c3 (diff)
downloadqemu-e3936fa574d9fbe241acdc76b5195b048567537e.tar.gz
pci: move unregister from PCIDevice to PCIDeviceInfo
One more cleanup while being at it ;) Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/e1000.c2
-rw-r--r--hw/eepro100.c5
-rw-r--r--hw/lsi53c895a.c2
-rw-r--r--hw/pci.c7
-rw-r--r--hw/pci.h1
-rw-r--r--hw/pcnet.c3
-rw-r--r--hw/rtl8139.c3
-rw-r--r--hw/virtio-pci.c1
8 files changed, 13 insertions, 11 deletions
diff --git a/hw/e1000.c b/hw/e1000.c
index 95c471c625..f123bda058 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1129,7 +1129,6 @@ static int pci_e1000_init(PCIDevice *pci_dev)
qemu_format_nic_info_str(d->vc, macaddr);
register_savevm(info_str, -1, 2, nic_save, nic_load, d);
- d->dev.unregister = pci_e1000_uninit;
qemu_register_reset(e1000_reset, d);
e1000_reset(d);
return 0;
@@ -1139,6 +1138,7 @@ static PCIDeviceInfo e1000_info = {
.qdev.name = "e1000",
.qdev.size = sizeof(E1000State),
.init = pci_e1000_init,
+ .exit = pci_e1000_uninit,
};
static void e1000_register_devices(void)
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 1d66edb99a..d446e71c60 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1778,8 +1778,6 @@ static int nic_init(PCIDevice *pci_dev, uint32_t device)
TRACE(OTHER, logout("\n"));
- s->dev.unregister = pci_nic_uninit;
-
s->device = device;
pci_reset(s);
@@ -1888,6 +1886,7 @@ static PCIDeviceInfo eepro100_info[] = {
.qdev.name = "i82551",
.qdev.size = sizeof(EEPRO100State),
.init = pci_i82551_init,
+ .exit = pci_nic_uninit,
},{
.qdev.name = "i82557a",
.qdev.size = sizeof(EEPRO100State),
@@ -1896,6 +1895,7 @@ static PCIDeviceInfo eepro100_info[] = {
.qdev.name = "i82557b",
.qdev.size = sizeof(EEPRO100State),
.init = pci_i82557b_init,
+ .exit = pci_nic_uninit,
},{
.qdev.name = "i82557c",
.qdev.size = sizeof(EEPRO100State),
@@ -1924,6 +1924,7 @@ static PCIDeviceInfo eepro100_info[] = {
.qdev.name = "i82559er",
.qdev.size = sizeof(EEPRO100State),
.init = pci_i82559er_init,
+ .exit = pci_nic_uninit,
},{
.qdev.name = "i82562",
.qdev.size = sizeof(EEPRO100State),
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 7c4539179a..a4d3a5740f 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2174,7 +2174,6 @@ static int lsi_scsi_init(PCIDevice *dev)
s->queue = qemu_malloc(sizeof(lsi_queue));
s->queue_len = 1;
s->active_commands = 0;
- s->dev.unregister = lsi_scsi_uninit;
lsi_soft_reset(s);
@@ -2189,6 +2188,7 @@ static PCIDeviceInfo lsi_info = {
.qdev.alias = "lsi",
.qdev.size = sizeof(LSIState),
.init = lsi_scsi_init,
+ .exit = lsi_scsi_uninit,
};
static void lsi53c895a_register_devices(void)
diff --git a/hw/pci.c b/hw/pci.c
index 0c7d7ec485..94b65d2e31 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -26,6 +26,7 @@
#include "monitor.h"
#include "net.h"
#include "sysemu.h"
+#include "msix.h"
//#define DEBUG_PCI
#ifdef DEBUG_PCI
@@ -402,13 +403,15 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)
static int pci_unregister_device(DeviceState *dev)
{
PCIDevice *pci_dev = DO_UPCAST(PCIDevice, qdev, dev);
+ PCIDeviceInfo *info = DO_UPCAST(PCIDeviceInfo, qdev, dev->info);
int ret = 0;
- if (pci_dev->unregister)
- ret = pci_dev->unregister(pci_dev);
+ if (info->exit)
+ ret = info->exit(pci_dev);
if (ret)
return ret;
+ msix_uninit(pci_dev);
pci_unregister_io_regions(pci_dev);
qemu_free_irqs(pci_dev->irq);
diff --git a/hw/pci.h b/hw/pci.h
index 9233b5bba8..24de8eb2a4 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -330,6 +330,7 @@ typedef int (*pci_qdev_initfn)(PCIDevice *dev);
typedef struct {
DeviceInfo qdev;
pci_qdev_initfn init;
+ PCIUnregisterFunc *exit;
PCIConfigReadFunc *config_read;
PCIConfigWriteFunc *config_write;
} PCIDeviceInfo;
diff --git a/hw/pcnet.c b/hw/pcnet.c
index ae98a201dc..ee0c98cc72 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -2039,8 +2039,6 @@ static int pci_pcnet_init(PCIDevice *pci_dev)
sizeof(struct pcnet_RMD), sizeof(struct pcnet_TMD));
#endif
- pci_dev->unregister = pci_pcnet_uninit;
-
pci_conf = pci_dev->config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_AMD);
@@ -2170,6 +2168,7 @@ static PCIDeviceInfo pcnet_info = {
.qdev.name = "pcnet",
.qdev.size = sizeof(PCIPCNetState),
.init = pci_pcnet_init,
+ .exit = pci_pcnet_uninit,
};
static void pcnet_register_devices(void)
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index 83cb1ff701..db9cb5afe0 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3443,8 +3443,6 @@ static int pci_rtl8139_init(PCIDevice *dev)
RTL8139State * s = DO_UPCAST(RTL8139State, dev, dev);
uint8_t *pci_conf;
- s->dev.unregister = pci_rtl8139_uninit;
-
pci_conf = s->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_REALTEK);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_REALTEK_8139);
@@ -3493,6 +3491,7 @@ static PCIDeviceInfo rtl8139_info = {
.qdev.size = sizeof(RTL8139State),
.qdev.reset = rtl8139_reset,
.init = pci_rtl8139_init,
+ .exit = pci_rtl8139_uninit,
};
static void rtl8139_register_devices(void)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index bd5a7c4d3a..c6fbaacb25 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -417,7 +417,6 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,
msix_bar_size(&proxy->pci_dev),
PCI_ADDRESS_SPACE_MEM,
msix_mmio_map);
- proxy->pci_dev.unregister = msix_uninit;
} else
vdev->nvectors = 0;