aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2015-03-08 22:33:58 -0400
committerBjorn Helgaas <bhelgaas@google.com>2015-03-12 16:04:01 -0400
commitc90570d9511d42421c85709b46bffd366185d835 (patch)
tree63febf1d38c816fa7c540a8238f7436a9a483813 /arch/unicore32
parentc517d838eb7d07bbe9507871fab3931deccff539 (diff)
PCI: Assign resources before drivers claim devices (pci_scan_bus())
Previously, pci_scan_bus() created a root PCI bus, enumerated the devices on it, and called pci_bus_add_devices(), which made the devices available for drivers to claim them. Most callers assigned resources to devices after pci_scan_bus() returns, which may be after drivers have claimed the devices. This is incorrect; the PCI core should not change device resources while a driver is managing the device. Remove pci_bus_add_devices() from pci_scan_bus() and do it after any resource assignment in the callers. [bhelgaas: changelog, check for failure in mcf_pci_init()] Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: "David S. Miller" <davem@davemloft.net> CC: Geert Uytterhoeven <geert@linux-m68k.org> CC: Guan Xuetao <gxt@mprc.pku.edu.cn> CC: Richard Henderson <rth@twiddle.net> CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru> CC: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'arch/unicore32')
-rw-r--r--arch/unicore32/kernel/pci.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/arch/unicore32/kernel/pci.c b/arch/unicore32/kernel/pci.c
index 374a055a8e6b..d45fa5f3e9c4 100644
--- a/arch/unicore32/kernel/pci.c
+++ b/arch/unicore32/kernel/pci.c
@@ -266,17 +266,10 @@ static int __init pci_common_init(void)
266 pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq); 266 pci_fixup_irqs(pci_common_swizzle, pci_puv3_map_irq);
267 267
268 if (!pci_has_flag(PCI_PROBE_ONLY)) { 268 if (!pci_has_flag(PCI_PROBE_ONLY)) {
269 /*
270 * Size the bridge windows.
271 */
272 pci_bus_size_bridges(puv3_bus); 269 pci_bus_size_bridges(puv3_bus);
273
274 /*
275 * Assign resources.
276 */
277 pci_bus_assign_resources(puv3_bus); 270 pci_bus_assign_resources(puv3_bus);
278 } 271 }
279 272 pci_bus_add_devices(puv3_bus);
280 return 0; 273 return 0;
281} 274}
282subsys_initcall(pci_common_init); 275subsys_initcall(pci_common_init);