Skip to content

Commit 7fec3ce

Browse files
committed
Merge tag 'pci-v5.8-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI fix from Bjorn Helgaas: "Fix a pcie_find_root_port() simplification that broke power management because it didn't handle the edge case of finding the Root Port of a Root Port itself (Mika Westerberg)"" * tag 'pci-v5.8-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: PCI: Make pcie_find_root_port() work for Root Ports
2 parents 718b7a5 + 5396956 commit 7fec3ce

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

include/linux/pci.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,12 +2169,11 @@ static inline int pci_pcie_type(const struct pci_dev *dev)
21692169
*/
21702170
static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
21712171
{
2172-
struct pci_dev *bridge = pci_upstream_bridge(dev);
2173-
2174-
while (bridge) {
2175-
if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT)
2176-
return bridge;
2177-
bridge = pci_upstream_bridge(bridge);
2172+
while (dev) {
2173+
if (pci_is_pcie(dev) &&
2174+
pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
2175+
return dev;
2176+
dev = pci_upstream_bridge(dev);
21782177
}
21792178

21802179
return NULL;

0 commit comments

Comments
 (0)