aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k
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/m68k
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/m68k')
-rw-r--r--arch/m68k/coldfire/pci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/m68k/coldfire/pci.c b/arch/m68k/coldfire/pci.c
index df9679238b6d..821de928dc3f 100644
--- a/arch/m68k/coldfire/pci.c
+++ b/arch/m68k/coldfire/pci.c
@@ -313,12 +313,16 @@ static int __init mcf_pci_init(void)
313 schedule_timeout(msecs_to_jiffies(200)); 313 schedule_timeout(msecs_to_jiffies(200));
314 314
315 rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL); 315 rootbus = pci_scan_bus(0, &mcf_pci_ops, NULL);
316 if (!rootbus)
317 return -ENODEV;
318
316 rootbus->resource[0] = &mcf_pci_io; 319 rootbus->resource[0] = &mcf_pci_io;
317 rootbus->resource[1] = &mcf_pci_mem; 320 rootbus->resource[1] = &mcf_pci_mem;
318 321
319 pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq); 322 pci_fixup_irqs(pci_common_swizzle, mcf_pci_map_irq);
320 pci_bus_size_bridges(rootbus); 323 pci_bus_size_bridges(rootbus);
321 pci_bus_assign_resources(rootbus); 324 pci_bus_assign_resources(rootbus);
325 pci_bus_add_devices(rootbus);
322 return 0; 326 return 0;
323} 327}
324 328