Commit a16f6d3a authored by Frederick Lawler's avatar Frederick Lawler Committed by David S. Miller

igc: Prefer pcie_capability_read_word()

Commit 8c0d3a02 ("PCI: Add accessors for PCI Express Capability")
added accessors for the PCI Express Capability so that drivers didn't
need to be aware of differences between v1 and v2 of the PCI
Express Capability.

Replace pci_read_config_word() and pci_write_config_word() calls with
pcie_capability_read_word() and pcie_capability_write_word().
Signed-off-by: default avatarFrederick Lawler <fred@fredlawl.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6133b920
...@@ -3912,13 +3912,11 @@ void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value) ...@@ -3912,13 +3912,11 @@ void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value)
s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value) s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
{ {
struct igc_adapter *adapter = hw->back; struct igc_adapter *adapter = hw->back;
u16 cap_offset;
cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP); if (!pci_is_pcie(adapter->pdev))
if (!cap_offset)
return -IGC_ERR_CONFIG; return -IGC_ERR_CONFIG;
pci_read_config_word(adapter->pdev, cap_offset + reg, value); pcie_capability_read_word(adapter->pdev, reg, value);
return IGC_SUCCESS; return IGC_SUCCESS;
} }
...@@ -3926,13 +3924,11 @@ s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value) ...@@ -3926,13 +3924,11 @@ s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value) s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
{ {
struct igc_adapter *adapter = hw->back; struct igc_adapter *adapter = hw->back;
u16 cap_offset;
cap_offset = pci_find_capability(adapter->pdev, PCI_CAP_ID_EXP); if (!pci_is_pcie(adapter->pdev))
if (!cap_offset)
return -IGC_ERR_CONFIG; return -IGC_ERR_CONFIG;
pci_write_config_word(adapter->pdev, cap_offset + reg, *value); pcie_capability_write_word(adapter->pdev, reg, *value);
return IGC_SUCCESS; return IGC_SUCCESS;
} }
......
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