aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie/aspm.c
diff options
context:
space:
mode:
authorYijing Wang <wangyijing@huawei.com>2012-07-24 05:20:03 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-08-23 11:40:57 -0400
commit62f87c0e31d646d5501edf4f7feb07d0ad689d80 (patch)
treef2aa208c10f6cf8b91634f91efda44efc6f4c25f /drivers/pci/pcie/aspm.c
parent786e22885d9959fda0473ace5a61cb11620fba9b (diff)
PCI: Introduce pci_pcie_type(dev) to replace pci_dev->pcie_type
Introduce an inline function pci_pcie_type(dev) to extract PCIe device type from pci_dev->pcie_flags_reg field, and prepare for removing pci_dev->pcie_type. Signed-off-by: Yijing Wang <wangyijing@huawei.com> Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/pcie/aspm.c')
-rw-r--r--drivers/pci/pcie/aspm.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index b500840a143b..25916034c0ae 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -412,7 +412,7 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
412 * do ASPM for now. 412 * do ASPM for now.
413 */ 413 */
414 list_for_each_entry(child, &linkbus->devices, bus_list) { 414 list_for_each_entry(child, &linkbus->devices, bus_list) {
415 if (child->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) { 415 if (pci_pcie_type(child) == PCI_EXP_TYPE_PCI_BRIDGE) {
416 link->aspm_disable = ASPM_STATE_ALL; 416 link->aspm_disable = ASPM_STATE_ALL;
417 break; 417 break;
418 } 418 }
@@ -425,8 +425,8 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)
425 struct aspm_latency *acceptable = 425 struct aspm_latency *acceptable =
426 &link->acceptable[PCI_FUNC(child->devfn)]; 426 &link->acceptable[PCI_FUNC(child->devfn)];
427 427
428 if (child->pcie_type != PCI_EXP_TYPE_ENDPOINT && 428 if (pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT &&
429 child->pcie_type != PCI_EXP_TYPE_LEG_END) 429 pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END)
430 continue; 430 continue;
431 431
432 pos = pci_pcie_cap(child); 432 pos = pci_pcie_cap(child);
@@ -552,7 +552,7 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev)
552 INIT_LIST_HEAD(&link->children); 552 INIT_LIST_HEAD(&link->children);
553 INIT_LIST_HEAD(&link->link); 553 INIT_LIST_HEAD(&link->link);
554 link->pdev = pdev; 554 link->pdev = pdev;
555 if (pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) { 555 if (pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM) {
556 struct pcie_link_state *parent; 556 struct pcie_link_state *parent;
557 parent = pdev->bus->parent->self->link_state; 557 parent = pdev->bus->parent->self->link_state;
558 if (!parent) { 558 if (!parent) {
@@ -585,12 +585,12 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
585 585
586 if (!pci_is_pcie(pdev) || pdev->link_state) 586 if (!pci_is_pcie(pdev) || pdev->link_state)
587 return; 587 return;
588 if (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && 588 if (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT &&
589 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) 589 pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM)
590 return; 590 return;
591 591
592 /* VIA has a strange chipset, root port is under a bridge */ 592 /* VIA has a strange chipset, root port is under a bridge */
593 if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT && 593 if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT &&
594 pdev->bus->self) 594 pdev->bus->self)
595 return; 595 return;
596 596
@@ -647,8 +647,8 @@ static void pcie_update_aspm_capable(struct pcie_link_state *root)
647 if (link->root != root) 647 if (link->root != root)
648 continue; 648 continue;
649 list_for_each_entry(child, &linkbus->devices, bus_list) { 649 list_for_each_entry(child, &linkbus->devices, bus_list) {
650 if ((child->pcie_type != PCI_EXP_TYPE_ENDPOINT) && 650 if ((pci_pcie_type(child) != PCI_EXP_TYPE_ENDPOINT) &&
651 (child->pcie_type != PCI_EXP_TYPE_LEG_END)) 651 (pci_pcie_type(child) != PCI_EXP_TYPE_LEG_END))
652 continue; 652 continue;
653 pcie_aspm_check_latency(child); 653 pcie_aspm_check_latency(child);
654 } 654 }
@@ -663,8 +663,8 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
663 663
664 if (!pci_is_pcie(pdev) || !parent || !parent->link_state) 664 if (!pci_is_pcie(pdev) || !parent || !parent->link_state)
665 return; 665 return;
666 if ((parent->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && 666 if ((pci_pcie_type(parent) != PCI_EXP_TYPE_ROOT_PORT) &&
667 (parent->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)) 667 (pci_pcie_type(parent) != PCI_EXP_TYPE_DOWNSTREAM))
668 return; 668 return;
669 669
670 down_read(&pci_bus_sem); 670 down_read(&pci_bus_sem);
@@ -704,8 +704,8 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev)
704 704
705 if (aspm_disabled || !pci_is_pcie(pdev) || !link) 705 if (aspm_disabled || !pci_is_pcie(pdev) || !link)
706 return; 706 return;
707 if ((pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && 707 if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) &&
708 (pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)) 708 (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM))
709 return; 709 return;
710 /* 710 /*
711 * Devices changed PM state, we should recheck if latency 711 * Devices changed PM state, we should recheck if latency
@@ -729,8 +729,8 @@ void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
729 if (aspm_policy != POLICY_POWERSAVE) 729 if (aspm_policy != POLICY_POWERSAVE)
730 return; 730 return;
731 731
732 if ((pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT) && 732 if ((pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT) &&
733 (pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM)) 733 (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM))
734 return; 734 return;
735 735
736 down_read(&pci_bus_sem); 736 down_read(&pci_bus_sem);
@@ -757,8 +757,8 @@ static void __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem,
757 if (!pci_is_pcie(pdev)) 757 if (!pci_is_pcie(pdev))
758 return; 758 return;
759 759
760 if (pdev->pcie_type == PCI_EXP_TYPE_ROOT_PORT || 760 if (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT ||
761 pdev->pcie_type == PCI_EXP_TYPE_DOWNSTREAM) 761 pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM)
762 parent = pdev; 762 parent = pdev;
763 if (!parent || !parent->link_state) 763 if (!parent || !parent->link_state)
764 return; 764 return;
@@ -933,8 +933,8 @@ void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
933 struct pcie_link_state *link_state = pdev->link_state; 933 struct pcie_link_state *link_state = pdev->link_state;
934 934
935 if (!pci_is_pcie(pdev) || 935 if (!pci_is_pcie(pdev) ||
936 (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && 936 (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT &&
937 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) 937 pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) || !link_state)
938 return; 938 return;
939 939
940 if (link_state->aspm_support) 940 if (link_state->aspm_support)
@@ -950,8 +950,8 @@ void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev)
950 struct pcie_link_state *link_state = pdev->link_state; 950 struct pcie_link_state *link_state = pdev->link_state;
951 951
952 if (!pci_is_pcie(pdev) || 952 if (!pci_is_pcie(pdev) ||
953 (pdev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && 953 (pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT &&
954 pdev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) || !link_state) 954 pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM) || !link_state)
955 return; 955 return;
956 956
957 if (link_state->aspm_support) 957 if (link_state->aspm_support)