aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Chiang <achiang@hp.com>2009-01-28 14:59:18 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-12 09:50:34 -0800
commite5e2130ff639ed7927363c5e7f4a266f3ccded5b (patch)
treeebcc12973d83f2ab3965bf0dbeb05dd9ec03201b
parent293ddedcb292d7e4a9e1df077a4e6a0b84dd0b96 (diff)
PCI: properly clean up ASPM link state on device remove
commit 3419c75e15f82c3ab09bd944fddbde72c9e4b3ea upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/pcie/aspm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 503f082f6c2..654938aabff 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -713,9 +713,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 */