aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/e1000e/netdev.c2
-rw-r--r--drivers/pci/pcie/aspm.c19
-rw-r--r--include/linux/pci-aspm.h1
3 files changed, 18 insertions, 4 deletions
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 506a0a0043b3..5fb43f098f17 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -5347,7 +5347,7 @@ static void e1000_complete_shutdown(struct pci_dev *pdev, bool sleep,
5347#ifdef CONFIG_PCIEASPM 5347#ifdef CONFIG_PCIEASPM
5348static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) 5348static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
5349{ 5349{
5350 pci_disable_link_state(pdev, state); 5350 pci_disable_link_state_locked(pdev, state);
5351} 5351}
5352#else 5352#else
5353static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state) 5353static void __e1000e_disable_aspm(struct pci_dev *pdev, u16 state)
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 */
737void pci_disable_link_state(struct pci_dev *pdev, int state) 737static 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
769void pci_disable_link_state_locked(struct pci_dev *pdev, int state)
770{
771 __pci_disable_link_state(pdev, state, false);
772}
773EXPORT_SYMBOL(pci_disable_link_state_locked);
774
775void pci_disable_link_state(struct pci_dev *pdev, int state)
776{
777 __pci_disable_link_state(pdev, state, true);
765} 778}
766EXPORT_SYMBOL(pci_disable_link_state); 779EXPORT_SYMBOL(pci_disable_link_state);
767 780
diff --git a/include/linux/pci-aspm.h b/include/linux/pci-aspm.h
index 67cb3ae38016..7cea7b6c1413 100644
--- a/include/linux/pci-aspm.h
+++ b/include/linux/pci-aspm.h
@@ -28,6 +28,7 @@ extern void pcie_aspm_exit_link_state(struct pci_dev *pdev);
28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev); 28extern void pcie_aspm_pm_state_change(struct pci_dev *pdev);
29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev); 29extern void pcie_aspm_powersave_config_link(struct pci_dev *pdev);
30extern void pci_disable_link_state(struct pci_dev *pdev, int state); 30extern void pci_disable_link_state(struct pci_dev *pdev, int state);
31extern void pci_disable_link_state_locked(struct pci_dev *pdev, int state);
31extern void pcie_clear_aspm(void); 32extern void pcie_clear_aspm(void);
32extern void pcie_no_aspm(void); 33extern void pcie_no_aspm(void);
33#else 34#else