diff options
author | Yijing Wang <wangyijing@huawei.com> | 2015-03-08 22:33:58 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-03-12 16:04:01 -0400 |
commit | c90570d9511d42421c85709b46bffd366185d835 (patch) | |
tree | 63febf1d38c816fa7c540a8238f7436a9a483813 /drivers/pci/hotplug/ibmphp_core.c | |
parent | c517d838eb7d07bbe9507871fab3931deccff539 (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 'drivers/pci/hotplug/ibmphp_core.c')
-rw-r--r-- | drivers/pci/hotplug/ibmphp_core.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c index 96c5c729cdbc..15302475f5b7 100644 --- a/drivers/pci/hotplug/ibmphp_core.c +++ b/drivers/pci/hotplug/ibmphp_core.c | |||
@@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func) | |||
738 | */ | 738 | */ |
739 | static u8 bus_structure_fixup(u8 busno) | 739 | static u8 bus_structure_fixup(u8 busno) |
740 | { | 740 | { |
741 | struct pci_bus *bus; | 741 | struct pci_bus *bus, *b; |
742 | struct pci_dev *dev; | 742 | struct pci_dev *dev; |
743 | u16 l; | 743 | u16 l; |
744 | 744 | ||
@@ -765,7 +765,11 @@ static u8 bus_structure_fixup(u8 busno) | |||
765 | (l != 0x0000) && (l != 0xffff)) { | 765 | (l != 0x0000) && (l != 0xffff)) { |
766 | debug("%s - Inside bus_structure_fixup()\n", | 766 | debug("%s - Inside bus_structure_fixup()\n", |
767 | __func__); | 767 | __func__); |
768 | pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); | 768 | b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL); |
769 | if (!b) | ||
770 | continue; | ||
771 | |||
772 | pci_bus_add_devices(b); | ||
769 | break; | 773 | break; |
770 | } | 774 | } |
771 | } | 775 | } |