diff mbox

[v4,13/30] PCI: Introduce new scan function pci_scan_root_bridge()

Message ID 1424938344-4017-14-git-send-email-wangyijing@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yijing Wang Feb. 26, 2015, 8:12 a.m. UTC
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 <wangyijing@huawei.com>
---
 drivers/pci/probe.c |   21 +++++++++++++++++++++
 include/linux/pci.h |    3 +++
 2 files changed, 24 insertions(+), 0 deletions(-)

Comments

Bjorn Helgaas March 3, 2015, 2:52 a.m. UTC | #1
On Thu, Feb 26, 2015 at 04:12:07PM +0800, Yijing Wang wrote:
> 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 <wangyijing@huawei.com>
> ---
>  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)

I prefer "host bridge" over "root bridge" because that's the terminology
used by the PCI specs.
Yijing Wang March 3, 2015, 8:12 a.m. UTC | #2
On 2015/3/3 10:52, Bjorn Helgaas wrote:
> On Thu, Feb 26, 2015 at 04:12:07PM +0800, Yijing Wang wrote:
>> 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 <wangyijing@huawei.com>
>> ---
>>  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)
> 
> I prefer "host bridge" over "root bridge" because that's the terminology
> used by the PCI specs.

OK, I will use "host bridge" instead of "root bridge".


> 
> .
>
diff mbox

Patch

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);