Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755488AbbDULjg (ORCPT ); Tue, 21 Apr 2015 07:39:36 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:15723 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752272AbbDULi1 (ORCPT ); Tue, 21 Apr 2015 07:38:27 -0400 From: Yijing Wang To: Bjorn Helgaas CC: Jiang Liu , , Yinghai Lu , , Marc Zyngier , , Russell King , , , Thomas Gleixner , Benjamin Herrenschmidt , Rusty Russell , Tony Luck , , "David S. Miller" , "Guan Xuetao" , , , Liviu Dudau , "Arnd Bergmann" , Geert Uytterhoeven , "Yijing Wang" Subject: [PATCH v10 17/29] x86/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge Date: Tue, 21 Apr 2015 19:34:36 +0800 Message-ID: <1429616088-10249-18-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1429616088-10249-1-git-send-email-wangyijing@huawei.com> References: <1429616088-10249-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2448 Lines: 84 Signed-off-by: Yijing Wang CC: Thomas Gleixner CC: x86@kernel.org --- arch/x86/pci/acpi.c | 37 +++++++++++++++++++++---------------- 1 files changed, 21 insertions(+), 16 deletions(-) diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index d6aab1c..ec16499 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c @@ -354,6 +354,19 @@ static void probe_pci_root_info(struct pci_root_info *info, } } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_sysdata *sd = dev_get_drvdata(&bridge->dev); + + ACPI_COMPANION_SET(&bridge->dev, sd->companion); + return 0; +} + +static struct pci_host_bridge_ops pci_host_ops = { + .pci_ops = &pci_root_ops, + .prepare = pci_host_bridge_prepare, +}; + struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) { struct acpi_device *device = root->device; @@ -364,6 +377,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) LIST_HEAD(crs_res); LIST_HEAD(resources); struct pci_bus *bus; + struct pci_host_bridge *host = NULL; struct pci_sysdata *sd; int node; @@ -430,14 +444,13 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) if (!setup_mcfg_map(info, domain, (u8)root->secondary.start, (u8)root->secondary.end, root->mcfg_addr)) - bus = pci_create_root_bus(NULL, domain, &pci_root_ops, - sd, &resources); - - if (bus) { - pci_scan_child_bus(bus); - pci_set_host_bridge_release( - to_pci_host_bridge(bus->bridge), - release_pci_root_info, info); + host = pci_scan_host_bridge(NULL, domain, sd, &resources, + &pci_host_ops); + + if (host) { + bus = host->bus; + pci_set_host_bridge_release(host, + release_pci_root_info, info); } else { resource_list_free(&resources); teardown_mcfg_map(info); @@ -460,14 +473,6 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) return bus; } -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_sysdata *sd = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, sd->companion); - return 0; -} - int __init pci_acpi_init(void) { struct pci_dev *dev = NULL; -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/