Skip to content

Commit e253aaf

Browse files
Yinghai Lubjorn-helgaas
authored andcommitted
PCI: Delay final fixups until resources are assigned
Commit 4f53509 "PCI: Put pci_dev in device tree as early as possible" moved final fixups from pci_bus_add_device() to pci_device_add(). But pci_device_add() happens before resource assignment, so BARs may not be valid yet. Typical flow for hot-add: pciehp_configure_device pci_scan_slot pci_scan_single_device pci_device_add pci_fixup_device(pci_fixup_final, dev) # previous location # resource assignment happens here pci_bus_add_devices pci_bus_add_device pci_fixup_device(pci_fixup_final, dev) # new location [bhelgaas: changelog, move fixups to pci_bus_add_device()] Reference: https://lkml.kernel.org/r/20130415182614.GB9224@xanatos Reported-by: David Bulkow <David.Bulkow@stratus.com> Tested-by: David Bulkow <David.Bulkow@stratus.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: stable@vger.kernel.org # v3.9+
1 parent dd72be9 commit e253aaf

2 files changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/pci/bus.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ int pci_bus_add_device(struct pci_dev *dev)
174174
* Can not put in pci_device_add yet because resources
175175
* are not assigned yet for some devices.
176176
*/
177+
pci_fixup_device(pci_fixup_final, dev);
177178
pci_create_sysfs_dev_files(dev);
178179

179180
dev->match_driver = true;

‎drivers/pci/probe.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,7 +1341,6 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
13411341
list_add_tail(&dev->bus_list, &bus->devices);
13421342
up_write(&pci_bus_sem);
13431343

1344-
pci_fixup_device(pci_fixup_final, dev);
13451344
ret = pcibios_add_device(dev);
13461345
WARN_ON(ret < 0);
13471346

0 commit comments

Comments
 (0)