From patchwork Thu Feb 26 01:29:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yijing Wang X-Patchwork-Id: 5886731 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A99F9BF440 for ; Thu, 26 Feb 2015 01:41:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D5EBB20373 for ; Thu, 26 Feb 2015 01:41:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E85E20381 for ; Thu, 26 Feb 2015 01:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426AbbBZBcX (ORCPT ); Wed, 25 Feb 2015 20:32:23 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:45500 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753093AbbBZBcS (ORCPT ); Wed, 25 Feb 2015 20:32:18 -0500 Received: from 172.24.2.119 (EHLO szxeml430-hub.china.huawei.com) ([172.24.2.119]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id BCI19483; Thu, 26 Feb 2015 09:32:13 +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; Thu, 26 Feb 2015 09:31:57 +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 v3 13/30] PCI: Introduce new scan function pci_scan_root_bridge() Date: Thu, 26 Feb 2015 09:29:30 +0800 Message-ID: <1424914187-21027-14-git-send-email-wangyijing@huawei.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1424914187-21027-1-git-send-email-wangyijing@huawei.com> References: <1424914187-21027-1-git-send-email-wangyijing@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.100.166] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.54EE779D.00F1, ss=1, re=0.001, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ef2bebd7d6f5e501681463ad9bf575da Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Introduce new scan function pci_scan_root_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 | 21 +++++++++++++++++++++ include/linux/pci.h | 3 +++ 2 files changed, 24 insertions(+), 0 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8cec6ab..b5f9ca4 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2063,6 +2063,27 @@ static struct pci_bus *__pci_scan_root_bus( return b; } +struct pci_host_bridge *pci_scan_root_bridge(struct device *parent, + u32 db, struct pci_ops *ops, void *sysdata, + struct list_head *resources, struct pci_host_bridge_ops *phb_ops) +{ + struct pci_host_bridge *host; + struct pci_bus *bus; + + host = pci_create_host_bridge(parent, db, resources, + sysdata, phb_ops); + if (!host) + return NULL; + + bus = __pci_scan_root_bus(host, ops); + if (!bus) + pci_free_host_bridge(host); + + return host; +} +EXPORT_SYMBOL(pci_scan_root_bridge); + + struct pci_bus *pci_scan_root_bus(struct device *parent, u32 db, struct pci_ops *ops, void *sysdata, struct list_head *resources) { diff --git a/include/linux/pci.h b/include/linux/pci.h index a4b56e0..ef3a821 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, u32 dombus, struct pci_ops *ops, void *sysdata, struct list_head *resources); +struct pci_host_bridge *pci_scan_root_bridge(struct device *parent, + u32 dombus, struct pci_ops *ops, void *sysdata, + struct list_head *resources, struct pci_host_bridge_ops *phb_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);