diff options
Diffstat (limited to 'drivers/pci/pcie/aspm.c')
-rw-r--r-- | drivers/pci/pcie/aspm.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 3eb667b24787..6892601fc76f 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -734,7 +734,7 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev) | |||
734 | * pci_disable_link_state - disable pci device's link state, so the link will | 734 | * pci_disable_link_state - disable pci device's link state, so the link will |
735 | * never enter specific states | 735 | * never enter specific states |
736 | */ | 736 | */ |
737 | void pci_disable_link_state(struct pci_dev *pdev, int state) | 737 | static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem) |
738 | { | 738 | { |
739 | struct pci_dev *parent = pdev->bus->self; | 739 | struct pci_dev *parent = pdev->bus->self; |
740 | struct pcie_link_state *link; | 740 | struct pcie_link_state *link; |
@@ -747,7 +747,8 @@ void pci_disable_link_state(struct pci_dev *pdev, int state) | |||
747 | if (!parent || !parent->link_state) | 747 | if (!parent || !parent->link_state) |
748 | return; | 748 | return; |
749 | 749 | ||
750 | down_read(&pci_bus_sem); | 750 | if (sem) |
751 | down_read(&pci_bus_sem); | ||
751 | mutex_lock(&aspm_lock); | 752 | mutex_lock(&aspm_lock); |
752 | link = parent->link_state; | 753 | link = parent->link_state; |
753 | if (state & PCIE_LINK_STATE_L0S) | 754 | if (state & PCIE_LINK_STATE_L0S) |
@@ -761,7 +762,19 @@ void pci_disable_link_state(struct pci_dev *pdev, int state) | |||
761 | pcie_set_clkpm(link, 0); | 762 | pcie_set_clkpm(link, 0); |
762 | } | 763 | } |
763 | mutex_unlock(&aspm_lock); | 764 | mutex_unlock(&aspm_lock); |
764 | up_read(&pci_bus_sem); | 765 | if (sem) |
766 | up_read(&pci_bus_sem); | ||
767 | } | ||
768 | |||
769 | void pci_disable_link_state_locked(struct pci_dev *pdev, int state) | ||
770 | { | ||
771 | __pci_disable_link_state(pdev, state, false); | ||
772 | } | ||
773 | EXPORT_SYMBOL(pci_disable_link_state_locked); | ||
774 | |||
775 | void pci_disable_link_state(struct pci_dev *pdev, int state) | ||
776 | { | ||
777 | __pci_disable_link_state(pdev, state, true); | ||
765 | } | 778 | } |
766 | EXPORT_SYMBOL(pci_disable_link_state); | 779 | EXPORT_SYMBOL(pci_disable_link_state); |
767 | 780 | ||