Received: from eggs.gnu.org ([2001:4830:134:3::10]:53101) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGpoU-0007EE-8L for qemu-devel@nongnu.org; Tue, 03 Sep 2013 08:34:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VGpoL-0006Vr-PO for qemu-devel@nongnu.org; Tue, 03 Sep 2013 08:34:30 -0400 Received: from mail-ee0-x229.google.com ([2a00:1450:4013:c00::229]:53047) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGpoL-0006Vd-E8 for qemu-devel@nongnu.org; Tue, 03 Sep 2013 08:34:21 -0400 Received: by mail-ee0-f41.google.com with SMTP id d17so2990870eek.28 for ; Tue, 03 Sep 2013 05:34:20 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 3 Sep 2013 14:33:15 +0200 Message-Id: <1378211609-16121-25-git-send-email-pbonzini@redhat.com> In-Reply-To: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> References: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 24/38] pci_bridge: split pci_bridge_free from pci_bridge_exitfn List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com Signed-off-by: Paolo Bonzini --- 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