From patchwork Tue Sep 3 12:33:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 272267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 43FC42C007A for ; Wed, 4 Sep 2013 00:03:10 +1000 (EST) Received: from localhost ([::1]:45532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VGpuo-0006eS-9Y for incoming@patchwork.ozlabs.org; Tue, 03 Sep 2013 08:41:02 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=8bI7CVM+uJhF4PP8nOTh/rE2LWYu6lTmlrRdoyQNwkQ=; b=JyWs4Mw9Fzkx9GUQyije2E8CdarZ/WMQFQDCIl+DJO6Xd8ATjIHnRJWvAoC/c9jVTB +N1or5FGmsyHMdXIvP6r1ZGawwahNM75qI0PezzOSHrCm+GarSDDG3cJdgsPkiuagN03 bWZxEZKpxtR4MWCkX8aPFUt0322kXnUgltsp4OZHCBkxSfQ2WwQf4mCUILvcYzt1Djfz D+mA4TrUCfRAlfHMXmp1zfOufkvX6776bddtPwBsCbAZ7yqas7n1Tr85z5tgWx7Nh/K7 o5b4bMBLry+gHv84sFXbr1y2CwtkZVR3s+qBQD3mfZ4WHNTbXyAvwTACkb/jOZhkwZ1L Gz+A== X-Received: by 10.14.218.197 with SMTP id k45mr46254498eep.32.1378211660562; Tue, 03 Sep 2013 05:34:20 -0700 (PDT) Received: from playground.lan (net-37-117-144-28.cust.dsl.vodafone.it. [37.117.144.28]) by mx.google.com with ESMTPSA id f49sm31150419eec.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 03 Sep 2013 05:34:19 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 3 Sep 2013 14:33:15 +0200 Message-Id: <1378211609-16121-25-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> References: <1378211609-16121-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c00::229 Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH 24/38] pci_bridge: split pci_bridge_free from pci_bridge_exitfn X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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); /*