PCI/portdrv: Remove pcie_port_bus_type link order dependency
The pcie_port_bus_type must be registered before drivers that depend on it can be registered. Those drivers include: pcied_init() # PCIe native hotplug driver aer_service_init() # AER driver dpc_service_init() # DPC driver pcie_pme_service_init() # PME driver Previously we registered pcie_port_bus_type from pcie_portdrv_init(), a device_initcall. The callers of pcie_port_service_register() (above) are also device_initcalls. This is fragile because the device_initcall ordering depends on link order, which is not explicit. Register pcie_port_bus_type from pci_driver_init() along with pci_bus_type. This removes the link order dependency between portdrv and the pciehp, AER, DPC, and PCIe PME drivers. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:

committed by
Bjorn Helgaas

parent
79a011194b
commit
c6c889d932
@@ -258,22 +258,11 @@ static const struct dmi_system_id pcie_portdrv_dmi_table[] __initconst = {
|
||||
|
||||
static int __init pcie_portdrv_init(void)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if (pcie_ports_disabled)
|
||||
return -EACCES;
|
||||
|
||||
dmi_check_system(pcie_portdrv_dmi_table);
|
||||
|
||||
retval = pcie_port_bus_register();
|
||||
if (retval) {
|
||||
printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval);
|
||||
goto out;
|
||||
}
|
||||
retval = pci_register_driver(&pcie_portdriver);
|
||||
if (retval)
|
||||
pcie_port_bus_unregister();
|
||||
out:
|
||||
return retval;
|
||||
return pci_register_driver(&pcie_portdriver);
|
||||
}
|
||||
device_initcall(pcie_portdrv_init);
|
||||
|
Reference in New Issue
Block a user