Commit e5c8ae5f authored by Jiang Liu's avatar Jiang Liu Committed by Bjorn Helgaas

cxgb4: Use PCI Express Capability accessors

Use PCI Express Capability access functions to simplify cxgb4 driver.
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent c772b44e
...@@ -3694,15 +3694,7 @@ static void __devinit print_port_info(const struct net_device *dev) ...@@ -3694,15 +3694,7 @@ static void __devinit print_port_info(const struct net_device *dev)
static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev) static void __devinit enable_pcie_relaxed_ordering(struct pci_dev *dev)
{ {
u16 v; pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_RELAX_EN);
int pos;
pos = pci_pcie_cap(dev);
if (pos > 0) {
pci_read_config_word(dev, pos + PCI_EXP_DEVCTL, &v);
v |= PCI_EXP_DEVCTL_RELAX_EN;
pci_write_config_word(dev, pos + PCI_EXP_DEVCTL, v);
}
} }
/* /*
......
...@@ -2741,11 +2741,9 @@ static void __devinit get_pci_mode(struct adapter *adapter, ...@@ -2741,11 +2741,9 @@ static void __devinit get_pci_mode(struct adapter *adapter,
struct pci_params *p) struct pci_params *p)
{ {
u16 val; u16 val;
u32 pcie_cap = pci_pcie_cap(adapter->pdev);
if (pcie_cap) { if (pci_is_pcie(adapter->pdev)) {
pci_read_config_word(adapter->pdev, pcie_cap + PCI_EXP_LNKSTA, pcie_capability_read_word(adapter->pdev, PCI_EXP_LNKSTA, &val);
&val);
p->speed = val & PCI_EXP_LNKSTA_CLS; p->speed = val & PCI_EXP_LNKSTA_CLS;
p->width = (val & PCI_EXP_LNKSTA_NLW) >> 4; p->width = (val & PCI_EXP_LNKSTA_NLW) >> 4;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment