diff options
author | Yijing Wang <wangyijing@huawei.com> | 2015-05-18 23:41:34 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-05-20 13:28:11 -0400 |
commit | f9b8cd7c2710813746f86eec6bbf12c869504285 (patch) | |
tree | c5cf075cc536f4ac10a10770e67810fbdd4f115b | |
parent | e127a04f222fc4ad958a9bca35100883b8b1373b (diff) |
PCI/ASPM: Remove redundant PCIe port type checking
We decide in alloc_pcie_link_state() whether to allocate a pcie_link_state
for a device. After that, it's sufficient to check pdev->link_state. We
don't need to check the PCIe port type again.
Remove the redundant PCIe port type checking.
[bhelgaas: changelog]
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r-- | drivers/pci/pcie/aspm.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index f90d8f2f091d..4e1af7637501 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c | |||
@@ -675,10 +675,7 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev) | |||
675 | { | 675 | { |
676 | struct pcie_link_state *link = pdev->link_state; | 676 | struct pcie_link_state *link = pdev->link_state; |
677 | 677 | ||
678 | if (aspm_disabled || !pci_is_pcie(pdev) || !link) | 678 | if (aspm_disabled || !link) |
679 | return; | ||
680 | if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) && | ||
681 | (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM)) | ||
682 | return; | 679 | return; |
683 | /* | 680 | /* |
684 | * Devices changed PM state, we should recheck if latency | 681 | * Devices changed PM state, we should recheck if latency |
@@ -696,16 +693,12 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev) | |||
696 | { | 693 | { |
697 | struct pcie_link_state *link = pdev->link_state; | 694 | struct pcie_link_state *link = pdev->link_state; |
698 | 695 | ||
699 | if (aspm_disabled || !pci_is_pcie(pdev) || !link) | 696 | if (aspm_disabled || !link) |
700 | return; | 697 | return; |
701 | 698 | ||
702 | if (aspm_policy != POLICY_POWERSAVE) | 699 | if (aspm_policy != POLICY_POWERSAVE) |
703 | return; | 700 | return; |
704 | 701 | ||
705 | if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) && | ||
706 | (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM)) | ||
707 | return; | ||
708 | |||
709 | down_read(&pci_bus_sem); | 702 | down_read(&pci_bus_sem); |
710 | mutex_lock(&aspm_lock); | 703 | mutex_lock(&aspm_lock); |
711 | pcie_config_aspm_path(link); | 704 | pcie_config_aspm_path(link); |
@@ -906,9 +899,7 @@ void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) | |||
906 | { | 899 | { |
907 | struct pcie_link_state *link_state = pdev->link_state; | 900 | struct pcie_link_state *link_state = pdev->link_state; |
908 | 901 | ||
909 | if (!pci_is_pcie(pdev) || | 902 | if (!link_state) |
910 | (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT && | ||
911 | pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) | ||
912 | return; | 903 | return; |
913 | 904 | ||
914 | if (link_state->aspm_support) | 905 | if (link_state->aspm_support) |
@@ -923,9 +914,7 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) | |||
923 | { | 914 | { |
924 | struct pcie_link_state *link_state = pdev->link_state; | 915 | struct pcie_link_state *link_state = pdev->link_state; |
925 | 916 | ||
926 | if (!pci_is_pcie(pdev) || | 917 | if (!link_state) |
927 | (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT && | ||
928 | pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) | ||
929 | return; | 918 | return; |
930 | 919 | ||
931 | if (link_state->aspm_support) | 920 | if (link_state->aspm_support) |