Skip to content

Commit 8c493cc

Browse files
Mani-Sadhasivambjorn-helgaas
authored andcommitted
PCI/pwrctrl: Create pwrctrl devices only when CONFIG_PCI_PWRCTRL is enabled
If devicetree describes power supplies related to a PCI device, we unnecessarily created a pwrctrl device even if CONFIG_PCI_PWRCTL was not enabled. We only need pci_pwrctrl_create_device() when CONFIG_PCI_PWRCTRL is enabled. Compile it out when CONFIG_PCI_PWRCTRL is not enabled. When pci_pwrctrl_create_device() creates and returns a pwrctrl device, pci_scan_device() doesn't enumerate the PCI device. It assumes the pwrctrl core will rescan the bus after turning on the power. However, if CONFIG_PCI_PWRCTRL is not enabled, the rescan never happens, which breaks PCI enumeration on any system that describes power supplies in devicetree but does not use pwrctrl. Jim reported that some brcmstb platforms break this way. The brcmstb driver is still broken if CONFIG_PCI_PWRCTRL is enabled, but this commit at least allows brcmstb to work when it's NOT enabled. Fixes: 957f40d ("PCI/pwrctrl: Move creation of pwrctrl devices to pci_scan_device()") Reported-by: Jim Quinlan <[email protected]> Link: https://lore.kernel.org/r/CA+-6iNwgaByXEYD3j=-+H_PKAxXRU78svPMRHDKKci8AGXAUPg@mail.gmail.com Signed-off-by: Manivannan Sadhasivam <[email protected]> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Lukas Wunner <[email protected]> Cc: [email protected] # v6.15 Link: https://patch.msgid.link/[email protected]
1 parent 19272b3 commit 8c493cc

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/pci/probe.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,6 +2508,7 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
25082508
}
25092509
EXPORT_SYMBOL(pci_bus_read_dev_vendor_id);
25102510

2511+
#if IS_ENABLED(CONFIG_PCI_PWRCTRL)
25112512
static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, int devfn)
25122513
{
25132514
struct pci_host_bridge *host = pci_find_host_bridge(bus);
@@ -2537,6 +2538,12 @@ static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, in
25372538

25382539
return pdev;
25392540
}
2541+
#else
2542+
static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *bus, int devfn)
2543+
{
2544+
return NULL;
2545+
}
2546+
#endif
25402547

25412548
/*
25422549
* Read the config data for a PCI device, sanity-check it,

0 commit comments

Comments
 (0)