Skip to content

Commit

Permalink
igb: Use PCI Express Capability accessors
Browse files Browse the repository at this point in the history
Use PCI Express Capability access functions to simplify igb driver.

[bhelgaas: split e1000e and igb into separate patches]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
  • Loading branch information
Jiang Liu authored and Bjorn Helgaas committed Aug 23, 2012
1 parent f8c0fca commit 23d028c
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions drivers/net/ethernet/intel/igb/igb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6539,28 +6539,20 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
{
struct igb_adapter *adapter = hw->back;
u16 cap_offset;

cap_offset = adapter->pdev->pcie_cap;
if (!cap_offset)
if (pcie_capability_read_word(adapter->pdev, reg, value))
return -E1000_ERR_CONFIG;

pci_read_config_word(adapter->pdev, cap_offset + reg, value);

return 0;
}

s32 igb_write_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
{
struct igb_adapter *adapter = hw->back;
u16 cap_offset;

cap_offset = adapter->pdev->pcie_cap;
if (!cap_offset)
if (pcie_capability_write_word(adapter->pdev, reg, *value))
return -E1000_ERR_CONFIG;

pci_write_config_word(adapter->pdev, cap_offset + reg, *value);

return 0;
}

Expand Down

0 comments on commit 23d028c

Please sign in to comment.