From patchwork Fri Apr 3 09:25:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 457883 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 590FC14016A for ; Fri, 3 Apr 2015 20:34:58 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbbDCJaT (ORCPT ); Fri, 3 Apr 2015 05:30:19 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:55299 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752684AbbDCJ3P (ORCPT ); Fri, 3 Apr 2015 05:29:15 -0400 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CLR08846; Fri, 03 Apr 2015 17:29:00 +0800 (CST) Received: from localhost.localdomain (10.175.100.166) by szxeml430-hub.china.huawei.com (10.82.67.185) with Microsoft SMTP Server id 14.3.158.1; Fri, 3 Apr 2015 17:28:47 +0800 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 v9 15/30] PCI: Introduce new scan function pci_scan_host_bridge() Date: Fri, 3 Apr 2015 17:25:49 +0800 Message-ID: <1428053164-28277-17-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1428053164-28277-1-git-send-email-wangyijing@huawei.com> References: <1428053164-28277-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Introduce new scan function pci_scan_host_bridge() to support host bridge drivers that need to provide platform own pci_host_bridge_ops. Signed-off-by: Yijing Wang --- drivers/pci/probe.c | 22 ++++++++++++++++++++++ include/linux/pci.h | 3 +++ 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 36dfee0..b3d9b1b 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2064,6 +2064,28 @@ static struct pci_bus *__pci_scan_root_bus( return b; } +struct pci_host_bridge *pci_scan_host_bridge( + struct device *parent, int domain, int bus, + void *sysdata, struct list_head *resources, + struct pci_host_bridge_ops *ops) +{ + struct pci_host_bridge *host; + + host = pci_create_host_bridge(parent, domain, bus, sysdata, + resources, ops); + if (!host) + return NULL; + + host->bus = __pci_scan_root_bus(host, ops->pci_ops); + if (!host->bus) { + pci_free_host_bridge(host); + return NULL; + } + + return host; +} +EXPORT_SYMBOL(pci_scan_host_bridge); + struct pci_bus *pci_scan_root_bus(struct device *parent, int domain, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources) diff --git a/include/linux/pci.h b/include/linux/pci.h index 2702a51..7f4f182 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -793,6 +793,9 @@ void pci_bus_release_busn_res(struct pci_bus *b); struct pci_bus *pci_scan_root_bus(struct device *parent, int domain, int bus, struct pci_ops *ops, void *sysdata, struct list_head *resources); +struct pci_host_bridge *pci_scan_host_bridge(struct device *parent, int domain, + int bus, void *sysdata, struct list_head *resources, + struct pci_host_bridge_ops *ops); struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); void pcie_update_link_speed(struct pci_bus *bus, u16 link_status);