Commit 7fec3ce5 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 718b7a57 5396956c
...@@ -2169,12 +2169,11 @@ static inline int pci_pcie_type(const struct pci_dev *dev) ...@@ -2169,12 +2169,11 @@ static inline int pci_pcie_type(const struct pci_dev *dev)
*/ */
static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev) static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
{ {
struct pci_dev *bridge = pci_upstream_bridge(dev); while (dev) {
if (pci_is_pcie(dev) &&
while (bridge) { pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT)
if (pci_pcie_type(bridge) == PCI_EXP_TYPE_ROOT_PORT) return dev;
return bridge; dev = pci_upstream_bridge(dev);
bridge = pci_upstream_bridge(bridge);
} }
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment