Skip to content

Commit

Permalink
PCI: properly clean up ASPM link state on device remove
Browse files Browse the repository at this point in the history
We only want to disable ASPM when the last function is removed from
the parent's device list. We determine this by checking to see if
the parent's device list is completely empty.

Unfortunately, we never hit that code because the parent is considered
an upstream port, and never had an ASPM link_state associated with it.

The early check for !link_state causes us to return early, we never
discover that our device list is empty, and thus we never remove the
downstream ports' link_state nodes.

Instead of checking to see if the parent's device list is empty, we can
check to see if we are the last device on the list, and if so, then we
know that we can clean up properly.

Cc: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Alex Chiang authored and Jesse Barnes committed Feb 5, 2009
1 parent eda58a8 commit 3419c75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/pci/pcie/aspm.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,9 +718,9 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)

/*
* All PCIe functions are in one slot, remove one function will remove
* the the whole slot, so just wait
* the whole slot, so just wait until we are the last function left.
*/
if (!list_empty(&parent->subordinate->devices))
if (!list_is_last(&pdev->bus_list, &parent->subordinate->devices))
goto out;

/* All functions are removed, so just disable ASPM for the link */
Expand Down

0 comments on commit 3419c75

Please sign in to comment.