From nobody Sat Feb 7 06:39:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492466693873607.8288241469085; Mon, 17 Apr 2017 15:04:53 -0700 (PDT) Received: from localhost ([::1]:38937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0ElQ-0004BG-Gd for importer@patchew.org; Mon, 17 Apr 2017 18:04:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54370) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d0Egi-0000h1-LY for qemu-devel@nongnu.org; Mon, 17 Apr 2017 18:00:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d0Egh-0005tH-Pk for qemu-devel@nongnu.org; Mon, 17 Apr 2017 18:00:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50976) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d0Egf-0005sT-83; Mon, 17 Apr 2017 17:59:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1197D33C17F; Mon, 17 Apr 2017 21:59:56 +0000 (UTC) Received: from localhost (ovpn-116-4.gru2.redhat.com [10.97.116.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6D545C54E; Mon, 17 Apr 2017 21:59:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1197D33C17F Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=ehabkost@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1197D33C17F From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Mon, 17 Apr 2017 18:59:16 -0300 Message-Id: <20170417215916.12431-8-ehabkost@redhat.com> In-Reply-To: <20170417215916.12431-1-ehabkost@redhat.com> References: <20170417215916.12431-1-ehabkost@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 17 Apr 2017 21:59:56 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 7/7] pci: Set phb->bus inside pci_bus_new_inplace() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , "Michael S. Tsirkin" , aik@ozlabs.ru, qemu-ppc@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Marcel Apfelbaum , David Gibson , Laszlo Ersek Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Every single caller of pci_bus_new_inplace() sets phb->bus to point to 'bus'. Do that inside pci_bus_new_inplace() to avoid code duplication and make it harder to break. Cc: "Herv=C3=A9 Poussineau" Cc: Marcel Apfelbaum Cc: "Michael S. Tsirkin" Cc: Peter Maydell Cc: qemu-arm@nongnu.org Cc: qemu-ppc@nongnu.org Signed-off-by: Eduardo Habkost Reviewed-by: David Gibson --- hw/pci-host/prep.c | 2 -- hw/pci-host/versatile.c | 1 - hw/pci/pci.c | 1 + 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 2e2cd267f4..6efa5bc5ef 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -284,8 +284,6 @@ static void raven_pcihost_initfn(Object *obj) address_space_init(&s->bm_as, &s->bm, "raven-bm"); pci_setup_iommu(&s->pci_bus, raven_pcihost_set_iommu, s); =20 - h->bus =3D &s->pci_bus; - object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVI= CE); pci_dev =3D DEVICE(&s->pci_dev); qdev_set_parent_bus(pci_dev, BUS(&s->pci_bus)); diff --git a/hw/pci-host/versatile.c b/hw/pci-host/versatile.c index 24ef87610b..630f1ac1c5 100644 --- a/hw/pci-host/versatile.c +++ b/hw/pci-host/versatile.c @@ -389,7 +389,6 @@ static void pci_vpb_init(Object *obj) pci_bus_new_inplace(&s->pci_bus, sizeof(s->pci_bus), h, "pci", &s->pci_mem_space, &s->pci_io_space, PCI_DEVFN(11, 0), TYPE_PCI_BUS); - h->bus =3D &s->pci_bus; =20 object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_VERSATILE_PCI_= HOST); qdev_set_parent_bus(DEVICE(&s->pci_dev), BUS(&s->pci_bus)); diff --git a/hw/pci/pci.c b/hw/pci/pci.c index 486aeb7514..ef226f8b41 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -397,6 +397,7 @@ void pci_bus_new_inplace(PCIBus *bus, size_t bus_size, { qbus_create_inplace(bus, bus_size, typename, DEVICE(phb), name); pci_bus_init(bus, phb, address_space_mem, address_space_io, devfn_min); + phb->bus =3D bus; } =20 PCIBus *pci_bus_new(PCIHostState *phb, const char *name, --=20 2.11.0.259.g40922b1