From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yinghai Lu Subject: [PATCH 22/23] PCI: make pci_rescan_bus_bridge_resize use pci_scan_bridge instead Date: Fri, 24 Feb 2012 02:19:10 -0800 Message-ID: <1330078751-7299-23-git-send-email-yinghai@kernel.org> References: <1330078751-7299-1-git-send-email-yinghai@kernel.org> Return-path: In-Reply-To: <1330078751-7299-1-git-send-email-yinghai@kernel.org> Sender: linux-kernel-owner@vger.kernel.org To: Jesse Barnes , Benjamin Herrenschmidt , Tony Luck Cc: Bjorn Helgaas , Dominik Brodowski , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Yinghai Lu List-Id: linux-arch.vger.kernel.org So after remove all children and then using setpci change bus register and rescan bridge could use new set bus number. Otherwise need to rescan parent bus, it would have too much overhead. also need to use pci_bus_add_single_device to make sure new change bus have directory /sys/../.../pci_bus. Signed-off-by: Yinghai Lu --- drivers/pci/probe.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 1c36b39..8063cf1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1961,14 +1961,16 @@ EXPORT_SYMBOL(pci_scan_bus); */ unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge) { - unsigned int max; - struct pci_bus *bus = bridge->subordinate; + unsigned int max = 0; + int pass; + struct pci_bus *bus = bridge->bus; - max = pci_scan_child_bus(bus); + for (pass = 0; pass < 2; pass++) + max = pci_scan_bridge(bus, bridge, max, pass); pci_assign_unassigned_bridge_resources(bridge); - pci_bus_add_devices(bus); + pci_bus_add_single_device(bridge); return max; } -- 1.7.7 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from acsinet15.oracle.com ([141.146.126.227]:17019 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757129Ab2BXKUX (ORCPT ); Fri, 24 Feb 2012 05:20:23 -0500 From: Yinghai Lu Subject: [PATCH 22/23] PCI: make pci_rescan_bus_bridge_resize use pci_scan_bridge instead Date: Fri, 24 Feb 2012 02:19:10 -0800 Message-ID: <1330078751-7299-23-git-send-email-yinghai@kernel.org> In-Reply-To: <1330078751-7299-1-git-send-email-yinghai@kernel.org> References: <1330078751-7299-1-git-send-email-yinghai@kernel.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Jesse Barnes , Benjamin Herrenschmidt , Tony Luck Cc: Bjorn Helgaas , Dominik Brodowski , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Yinghai Lu Message-ID: <20120224101910.601IUoyTig60Z8oCF0ebE9k9AHaiP_P39QMHwUeqmPg@z> So after remove all children and then using setpci change bus register and rescan bridge could use new set bus number. Otherwise need to rescan parent bus, it would have too much overhead. also need to use pci_bus_add_single_device to make sure new change bus have directory /sys/../.../pci_bus. Signed-off-by: Yinghai Lu --- drivers/pci/probe.c | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 1c36b39..8063cf1 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1961,14 +1961,16 @@ EXPORT_SYMBOL(pci_scan_bus); */ unsigned int __ref pci_rescan_bus_bridge_resize(struct pci_dev *bridge) { - unsigned int max; - struct pci_bus *bus = bridge->subordinate; + unsigned int max = 0; + int pass; + struct pci_bus *bus = bridge->bus; - max = pci_scan_child_bus(bus); + for (pass = 0; pass < 2; pass++) + max = pci_scan_bridge(bus, bridge, max, pass); pci_assign_unassigned_bridge_resources(bridge); - pci_bus_add_devices(bus); + pci_bus_add_single_device(bridge); return max; } -- 1.7.7