提交 f9b8cd7c 编写于 作者: Y Yijing Wang 提交者: Bjorn Helgaas

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: NYijing Wang <wangyijing@huawei.com>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
上级 e127a04f
...@@ -675,10 +675,7 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev) ...@@ -675,10 +675,7 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev)
{ {
struct pcie_link_state *link = pdev->link_state; struct pcie_link_state *link = pdev->link_state;
if (aspm_disabled || !pci_is_pcie(pdev) || !link) if (aspm_disabled || !link)
return;
if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) &&
(pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM))
return; return;
/* /*
* Devices changed PM state, we should recheck if latency * Devices changed PM state, we should recheck if latency
...@@ -696,16 +693,12 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev) ...@@ -696,16 +693,12 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
{ {
struct pcie_link_state *link = pdev->link_state; struct pcie_link_state *link = pdev->link_state;
if (aspm_disabled || !pci_is_pcie(pdev) || !link) if (aspm_disabled || !link)
return; return;
if (aspm_policy != POLICY_POWERSAVE) if (aspm_policy != POLICY_POWERSAVE)
return; return;
if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) &&
(pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM))
return;
down_read(&pci_bus_sem); down_read(&pci_bus_sem);
mutex_lock(&aspm_lock); mutex_lock(&aspm_lock);
pcie_config_aspm_path(link); pcie_config_aspm_path(link);
...@@ -906,9 +899,7 @@ void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) ...@@ -906,9 +899,7 @@ void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
{ {
struct pcie_link_state *link_state = pdev->link_state; struct pcie_link_state *link_state = pdev->link_state;
if (!pci_is_pcie(pdev) || if (!link_state)
(pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT &&
pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) || !link_state)
return; return;
if (link_state->aspm_support) if (link_state->aspm_support)
...@@ -923,9 +914,7 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) ...@@ -923,9 +914,7 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
{ {
struct pcie_link_state *link_state = pdev->link_state; struct pcie_link_state *link_state = pdev->link_state;
if (!pci_is_pcie(pdev) || if (!link_state)
(pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT &&
pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) || !link_state)
return; return;
if (link_state->aspm_support) if (link_state->aspm_support)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册