[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1425868467-9667-16-git-send-email-wangyijing@huawei.com>
Date: Mon, 9 Mar 2015 10:34:12 +0800
From: Yijing Wang <wangyijing@...wei.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
CC: Jiang Liu <jiang.liu@...ux.intel.com>, <linux-pci@...r.kernel.org>,
Yinghai Lu <yinghai@...nel.org>,
<linux-kernel@...r.kernel.org>,
Marc Zyngier <marc.zyngier@....com>,
<linux-arm-kernel@...ts.infradead.org>,
Russell King <linux@....linux.org.uk>, <x86@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Rusty Russell <rusty@...tcorp.com.au>,
Tony Luck <tony.luck@...el.com>, <linux-ia64@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
"Guan Xuetao" <gxt@...c.pku.edu.cn>, <linux-alpha@...r.kernel.org>,
<linux-m68k@...ts.linux-m68k.org>, Liviu Dudau <liviu@...au.co.uk>,
"Arnd Bergmann" <arnd@...db.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
"Yijing Wang" <wangyijing@...wei.com>,
Yijing Wang <wangyijing0307@...il.com>,
"Fenghua Yu" <fenghua.yu@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: [PATCH v6 15/30] ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
From: Yijing Wang <wangyijing0307@...il.com>
Signed-off-by: Yijing Wang <wangyijing@...wei.com>
CC: Tony Luck <tony.luck@...el.com>
CC: Fenghua Yu <fenghua.yu@...el.com>
CC: linux-ia64@...r.kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
arch/ia64/pci/pci.c | 34 ++++++++++++++++++----------------
1 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 675749f..0245862 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -420,6 +420,18 @@ 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 phb_ops = {
+ .prepare = pci_host_bridge_prepare,
+};
+
struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
{
struct acpi_device *device = root->device;
@@ -428,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);
@@ -465,26 +477,16 @@ 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, PCI_DOMBUS(domain, bus),
- &pci_root_ops, controller, &info->resources);
- if (!pbus) {
+ host = pci_scan_host_bridge(NULL, PCI_DOMBUS(domain, bus),
+ &pci_root_ops, controller, &info->resources, &phb_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),
- 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;
+ pci_set_host_bridge_release(host, release_pci_root_info, info);
+ 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists