[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 24/38] pci_bridge: split pci_bridge_free from pci_br
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 24/38] pci_bridge: split pci_bridge_free from pci_bridge_exitfn |
Date: |
Tue, 3 Sep 2013 14:33:15 +0200 |
Signed-off-by: Paolo Bonzini <address@hidden>
---
hw/pci-bridge/i82801b11.c | 1 +
hw/pci-bridge/ioh3420.c | 2 ++
hw/pci-bridge/pci_bridge_dev.c | 2 ++
hw/pci-bridge/xio3130_downstream.c | 2 ++
hw/pci-bridge/xio3130_upstream.c | 2 ++
hw/pci/pci_bridge.c | 5 +++++
include/hw/pci/pci_bridge.h | 1 +
7 files changed, 15 insertions(+)
diff --git a/hw/pci-bridge/i82801b11.c b/hw/pci-bridge/i82801b11.c
index 14cd7fd..a3cc64c 100644
--- a/hw/pci-bridge/i82801b11.c
+++ b/hw/pci-bridge/i82801b11.c
@@ -76,6 +76,7 @@ static int i82801b11_bridge_initfn(PCIDevice *d)
err_bridge:
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
return rc;
}
diff --git a/hw/pci-bridge/ioh3420.c b/hw/pci-bridge/ioh3420.c
index 0f7f209..16f0cf8 100644
--- a/hw/pci-bridge/ioh3420.c
+++ b/hw/pci-bridge/ioh3420.c
@@ -142,6 +142,7 @@ err_msi:
msi_uninit(d);
err_bridge:
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
return rc;
}
@@ -154,6 +155,7 @@ static void ioh3420_exitfn(PCIDevice *d)
pcie_cap_exit(d);
msi_uninit(d);
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
}
PCIESlot *ioh3420_init(PCIBus *bus, int devfn, bool multifunction,
diff --git a/hw/pci-bridge/pci_bridge_dev.c b/hw/pci-bridge/pci_bridge_dev.c
index 97dfc49..970a5b9 100644
--- a/hw/pci-bridge/pci_bridge_dev.c
+++ b/hw/pci-bridge/pci_bridge_dev.c
@@ -83,6 +83,7 @@ slotid_error:
shpc_error:
memory_region_destroy(&bridge_dev->bar);
pci_bridge_exitfn(dev);
+ pci_bridge_free(dev);
bridge_error:
return err;
}
@@ -98,6 +99,7 @@ static void pci_bridge_dev_exitfn(PCIDevice *dev)
shpc_free(dev);
memory_region_destroy(&bridge_dev->bar);
pci_bridge_exitfn(dev);
+ pci_bridge_free(dev);
}
static void pci_bridge_dev_write_config(PCIDevice *d,
diff --git a/hw/pci-bridge/xio3130_downstream.c
b/hw/pci-bridge/xio3130_downstream.c
index 94f9781..a0ac179 100644
--- a/hw/pci-bridge/xio3130_downstream.c
+++ b/hw/pci-bridge/xio3130_downstream.c
@@ -107,6 +107,7 @@ err_msi:
msi_uninit(d);
err_bridge:
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
return rc;
}
@@ -119,6 +120,7 @@ static void xio3130_downstream_exitfn(PCIDevice *d)
pcie_cap_exit(d);
msi_uninit(d);
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
}
PCIESlot *xio3130_downstream_init(PCIBus *bus, int devfn, bool multifunction,
diff --git a/hw/pci-bridge/xio3130_upstream.c b/hw/pci-bridge/xio3130_upstream.c
index 59f97f6..682a7e5 100644
--- a/hw/pci-bridge/xio3130_upstream.c
+++ b/hw/pci-bridge/xio3130_upstream.c
@@ -94,6 +94,7 @@ err_msi:
msi_uninit(d);
err_bridge:
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
return rc;
}
@@ -103,6 +104,7 @@ static void xio3130_upstream_exitfn(PCIDevice *d)
pcie_cap_exit(d);
msi_uninit(d);
pci_bridge_exitfn(d);
+ pci_bridge_free(d);
}
PCIEPort *xio3130_upstream_init(PCIBus *bus, int devfn, bool multifunction,
diff --git a/hw/pci/pci_bridge.c b/hw/pci/pci_bridge.c
index a90671d..307e076 100644
--- a/hw/pci/pci_bridge.c
+++ b/hw/pci/pci_bridge.c
@@ -387,6 +387,11 @@ void pci_bridge_exitfn(PCIDevice *pci_dev)
assert(QLIST_EMPTY(&s->sec_bus.child));
QLIST_REMOVE(&s->sec_bus, sibling);
pci_bridge_region_del(s, s->windows);
+}
+
+void pci_bridge_free(PCIDevice *pci_dev)
+{
+ PCIBridge *s = PCI_BRIDGE(pci_dev);
pci_bridge_region_cleanup(s, s->windows);
memory_region_destroy(&s->address_space_mem);
memory_region_destroy(&s->address_space_io);
diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h
index 1d8f997..5be3ac9 100644
--- a/include/hw/pci/pci_bridge.h
+++ b/include/hw/pci/pci_bridge.h
@@ -46,6 +46,7 @@ void pci_bridge_reset(DeviceState *qdev);
int pci_bridge_initfn(PCIDevice *pci_dev, const char *typename);
void pci_bridge_exitfn(PCIDevice *pci_dev);
+void pci_bridge_free(PCIDevice *pci_dev);
/*
--
1.8.3.1
- [Qemu-devel] [PATCH 18/38] eepro100: use instance_finalize instead of exit, (continued)
- [Qemu-devel] [PATCH 18/38] eepro100: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 19/38] ne2000: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 20/38] pcnet: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 22/38] vmxnet3: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 21/38] rtl8139: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 23/38] shpc: split shpc_free from shpc_cleanup, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 25/38] pcie_aer: pcie_aer_exit really frees stuff, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 24/38] pci_bridge: split pci_bridge_free from pci_bridge_exitfn,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 26/38] pci_bridge: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 27/38] ioh4320: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 28/38] xio3130-downstream: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 29/38] xio3130-upstream: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 30/38] pcie: do not recreate mmcfg I/O region, use an alias instead, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 31/38] esp: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 32/38] lsi: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 34/38] usb-uhci: use instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 33/38] pvscsi: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03
- [Qemu-devel] [PATCH 35/38] virtio-pci: reclaim memory in instance_finalize instead of exit, Paolo Bonzini, 2013/09/03