From patchwork Tue Jun 4 18:52:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 248825 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 DC3C62C0090 for ; Wed, 5 Jun 2013 04:59:52 +1000 (EST) Received: from localhost ([::1]:59624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwSV-0000lI-2D for incoming@patchwork.ozlabs.org; Tue, 04 Jun 2013 14:59:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53562) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMU-0008BG-4R for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjwMS-0007k8-Up for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:38 -0400 Received: from mail-wg0-x22a.google.com ([2a00:1450:400c:c00::22a]:38433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjwMS-0007iw-Ln for qemu-devel@nongnu.org; Tue, 04 Jun 2013 14:53:36 -0400 Received: by mail-wg0-f42.google.com with SMTP id n12so4166299wgh.5 for ; Tue, 04 Jun 2013 11:53:36 -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:x-mailer:in-reply-to :references; bh=ht10XIdbvBBaubxfOLENan5wTjp0r5OqGgcng2iobwE=; b=h8D75ddQOz/gJT0Bn97Y+BOkwgjdWXUtt7bRYcdF+l/ofHf0rje3hAAa3WZKxMrhoV 3fEa7zabwY3K/AflC2MtVHoZyC7LXRdEEFBjkarhRaxsbIdarhACWu44Zubkbk37LnxJ L4w+u0oeBXHW8v1R/sysYfKiSljaYi00orTiV2DXsT/u44WJlEH35p0t6gFTfGRvtXHK xnaHScY63h4igB2NGU49/wb3rdT3QUP9McJyxPTG53126qhjzuBeA5NfdGMKP2rCygAe wc20+749G6m9VIYYVVyX2k+xYqVfj5+Vuxx0F73k+xJv18ROzHNtHlOBJUfR3n3PqvSl d7ZA== X-Received: by 10.194.235.130 with SMTP id um2mr25232093wjc.30.1370372015995; Tue, 04 Jun 2013 11:53:35 -0700 (PDT) Received: from playground.lan (net-37-116-217-184.cust.dsl.vodafone.it. [37.116.217.184]) by mx.google.com with ESMTPSA id fx7sm4590484wic.11.2013.06.04.11.53.34 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 04 Jun 2013 11:53:35 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 4 Jun 2013 20:52:20 +0200 Message-Id: <1370371954-8479-26-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370371954-8479-1-git-send-email-pbonzini@redhat.com> References: <1370371954-8479-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:400c:c00::22a Cc: mst@redhat.com Subject: [Qemu-devel] [PATCH 25/39] 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 5807a92..f965958 100644 --- a/hw/pci-bridge/i82801b11.c +++ b/hw/pci-bridge/i82801b11.c @@ -74,6 +74,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 bb541eb..74ab7c8 100644 --- a/hw/pci-bridge/ioh3420.c +++ b/hw/pci-bridge/ioh3420.c @@ -143,6 +143,7 @@ err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); + pci_bridge_free(d); return rc; } @@ -157,6 +158,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 39deb1f..c1aab15 100644 --- a/hw/pci-bridge/pci_bridge_dev.c +++ b/hw/pci-bridge/pci_bridge_dev.c @@ -76,6 +76,7 @@ slotid_error: shpc_error: memory_region_destroy(&bridge_dev->bar); pci_bridge_exitfn(dev); + pci_bridge_free(dev); bridge_error: return err; } @@ -92,6 +93,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 1810dd2..57af725 100644 --- a/hw/pci-bridge/xio3130_downstream.c +++ b/hw/pci-bridge/xio3130_downstream.c @@ -108,6 +108,7 @@ err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); + pci_bridge_free(d); return rc; } @@ -122,6 +123,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 8e0d97a..58c3d29 100644 --- a/hw/pci-bridge/xio3130_upstream.c +++ b/hw/pci-bridge/xio3130_upstream.c @@ -95,6 +95,7 @@ err_msi: msi_uninit(d); err_bridge: pci_bridge_exitfn(d); + pci_bridge_free(d); return rc; } @@ -104,6 +105,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 24be6c5..4191729 100644 --- a/hw/pci/pci_bridge.c +++ b/hw/pci/pci_bridge.c @@ -383,6 +383,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 = DO_UPCAST(PCIBridge, dev, 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 1868f7a..99ba0eb 100644 --- a/include/hw/pci/pci_bridge.h +++ b/include/hw/pci/pci_bridge.h @@ -45,6 +45,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); /*