Skip to content

Commit c8b303d

Browse files
committed
PCI: Remove PCIe Capability version checks
Previously we relied on the PCIe r3.0, sec 7.8, spec language that says "For Functions that do not implement the [Link, Slot, Root] registers, these spaces must be hardwired to 0b," which means that for v2 PCIe capabilities, we don't need to check the device type at all. But it's simpler if we don't need to check the capability version at all, and I think the spec is explicit enough about which registers are required for which types that we can remove the version checks. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-By: Jiang Liu <jiang.liu@huawei.com>
1 parent d3694d4 commit c8b303d

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎drivers/pci/access.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ static inline bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
484484
{
485485
int type = pci_pcie_type(dev);
486486

487-
return pcie_cap_version(dev) > 1 ||
488-
type == PCI_EXP_TYPE_ENDPOINT ||
487+
return type == PCI_EXP_TYPE_ENDPOINT ||
489488
type == PCI_EXP_TYPE_LEG_END ||
490489
type == PCI_EXP_TYPE_ROOT_PORT ||
491490
type == PCI_EXP_TYPE_UPSTREAM ||
@@ -498,8 +497,7 @@ static inline bool pcie_cap_has_sltctl(const struct pci_dev *dev)
498497
{
499498
int type = pci_pcie_type(dev);
500499

501-
return pcie_cap_version(dev) > 1 ||
502-
type == PCI_EXP_TYPE_ROOT_PORT ||
500+
return type == PCI_EXP_TYPE_ROOT_PORT ||
503501
(type == PCI_EXP_TYPE_DOWNSTREAM &&
504502
pcie_caps_reg(dev) & PCI_EXP_FLAGS_SLOT);
505503
}
@@ -508,8 +506,7 @@ static inline bool pcie_cap_has_rtctl(const struct pci_dev *dev)
508506
{
509507
int type = pci_pcie_type(dev);
510508

511-
return pcie_cap_version(dev) > 1 ||
512-
type == PCI_EXP_TYPE_ROOT_PORT ||
509+
return type == PCI_EXP_TYPE_ROOT_PORT ||
513510
type == PCI_EXP_TYPE_RC_EC;
514511
}
515512

0 commit comments

Comments
 (0)