Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84fb913c authored by Myron Stowe's avatar Myron Stowe Committed by Bjorn Helgaas
Browse files

PCI/ASPM: Deallocate upstream link state even if device is not PCIe



On PCI bus hotplug removal, pcie_aspm_exit_link_state() can potentially
skip parent devices that have link_state allocated.  Instead of exiting
early if a given device is not PCIe, check whether or not the device's
parent has link_state allocated.  This enables pcie_aspm_exit_link_state()
to properly clean up parent link_state when the last function in a slot
might not be PCIe.

Reported-by: default avatarJoe Lawrence <joe.lawrence@stratus.com>
Tested-by: default avatarJoe Lawrence <joe.lawrence@stratus.com>
Signed-off-by: default avatarMyron Stowe <myron.stowe@redhat.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent d1c3ed66
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -634,10 +634,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
	struct pci_dev *parent = pdev->bus->self;
	struct pci_dev *parent = pdev->bus->self;
	struct pcie_link_state *link, *root, *parent_link;
	struct pcie_link_state *link, *root, *parent_link;


	if (!pci_is_pcie(pdev) || !parent || !parent->link_state)
	if (!parent || !parent->link_state)
		return;
	if ((pci_pcie_type(parent) != PCI_EXP_TYPE_ROOT_PORT) &&
	    (pci_pcie_type(parent) != PCI_EXP_TYPE_DOWNSTREAM))
		return;
		return;


	down_read(&pci_bus_sem);
	down_read(&pci_bus_sem);