mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
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 <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> CC: "David S. Miller" <[email protected]> CC: Geert Uytterhoeven <[email protected]> CC: Guan Xuetao <[email protected]> CC: Richard Henderson <[email protected]> CC: Ivan Kokshaysky <[email protected]> CC: Matt Turner <[email protected]>
This commit is contained in:
parent
c517d838eb
commit
c90570d951
6 changed files with 19 additions and 11 deletions
|
|
@ -738,7 +738,7 @@ static void ibm_unconfigure_device(struct pci_func *func)
|
|||
*/
|
||||
static u8 bus_structure_fixup(u8 busno)
|
||||
{
|
||||
struct pci_bus *bus;
|
||||
struct pci_bus *bus, *b;
|
||||
struct pci_dev *dev;
|
||||
u16 l;
|
||||
|
||||
|
|
@ -765,7 +765,11 @@ static u8 bus_structure_fixup(u8 busno)
|
|||
(l != 0x0000) && (l != 0xffff)) {
|
||||
debug("%s - Inside bus_structure_fixup()\n",
|
||||
__func__);
|
||||
pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
|
||||
b = pci_scan_bus(busno, ibmphp_pci_bus->ops, NULL);
|
||||
if (!b)
|
||||
continue;
|
||||
|
||||
pci_bus_add_devices(b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2123,7 +2123,6 @@ struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops,
|
|||
b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources);
|
||||
if (b) {
|
||||
pci_scan_child_bus(b);
|
||||
pci_bus_add_devices(b);
|
||||
} else {
|
||||
pci_free_resource_list(&resources);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue