Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755395AbbDULjU (ORCPT ); Tue, 21 Apr 2015 07:39:20 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:15454 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754600AbbDULiS (ORCPT ); Tue, 21 Apr 2015 07:38:18 -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" , Yijing Wang , "Fenghua Yu" Subject: [PATCH v10 18/29] ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge Date: Tue, 21 Apr 2015 19:34:37 +0800 Message-ID: <1429616088-10249-19-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: 2573 Lines: 83 From: Yijing Wang Signed-off-by: Yijing Wang CC: Tony Luck CC: Fenghua Yu CC: linux-ia64@vger.kernel.org --- arch/ia64/pci/pci.c | 34 +++++++++++++++++++--------------- 1 files changed, 19 insertions(+), 15 deletions(-) diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 84f1eb8..7f3b9fb 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c @@ -420,6 +420,19 @@ probe_pci_root_info(struct pci_root_info *info, struct acpi_device *device, return 0; } +static int pci_host_bridge_prepare(struct pci_host_bridge *bridge) +{ + struct pci_controller *controller = bridge->bus->sysdata; + + ACPI_COMPANION_SET(&bridge->dev, controller->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; @@ -427,7 +440,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) struct pci_controller *controller; struct pci_root_info *info = NULL; int busnum = root->secondary.start; - struct pci_bus *pbus; + struct pci_host_bridge *host; int ret; controller = alloc_pci_controller(domain); @@ -464,26 +477,17 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) * should handle the case here, but it appears that IA64 hasn't * such quirk. So we just ignore the case now. */ - pbus = pci_create_root_bus(NULL, domain, &pci_root_ops, - controller, &info->resources); - if (!pbus) { + host = pci_scan_host_bridge(NULL, domain, controller, + &info->resources, &pci_host_ops); + if (!host) { pci_free_resource_list(&info->resources); __release_pci_root_info(info); return NULL; } - pci_set_host_bridge_release(to_pci_host_bridge(pbus->bridge), + pci_set_host_bridge_release(host, release_pci_root_info, info); - pci_scan_child_bus(pbus); - return pbus; -} - -int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge) -{ - struct pci_controller *controller = bridge->bus->sysdata; - - ACPI_COMPANION_SET(&bridge->dev, controller->companion); - return 0; + return host->bus; } void pcibios_fixup_device_resources(struct pci_dev *dev) -- 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/