Skip to content

Commit bf88f7d

Browse files
ij-intelanguy11
authored andcommitted
e1000e: Use pcie_capability_read_word() for reading LNKSTA
Use pcie_capability_read_word() for reading LNKSTA and remove the custom define that matches to PCI_EXP_LNKSTA. As only single user for cap_offset remains, replace it with a call to pci_pcie_cap(). Instead of e1000_adapter, make local variable out of pci_dev because both users are interested in it. Signed-off-by: Ilpo Järvinen <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Naama Meir <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 4c39e76 commit bf88f7d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

drivers/net/ethernet/intel/e1000e/defines.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,6 @@
678678

679679
/* PCI/PCI-X/PCI-EX Config space */
680680
#define PCI_HEADER_TYPE_REGISTER 0x0E
681-
#define PCIE_LINK_STATUS 0x12
682681

683682
#define PCI_HEADER_TYPE_MULTIFUNC 0x80
684683

drivers/net/ethernet/intel/e1000e/mac.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,15 @@
1515
**/
1616
s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw)
1717
{
18+
struct pci_dev *pdev = hw->adapter->pdev;
1819
struct e1000_mac_info *mac = &hw->mac;
1920
struct e1000_bus_info *bus = &hw->bus;
20-
struct e1000_adapter *adapter = hw->adapter;
21-
u16 pcie_link_status, cap_offset;
21+
u16 pcie_link_status;
2222

23-
cap_offset = adapter->pdev->pcie_cap;
24-
if (!cap_offset) {
23+
if (!pci_pcie_cap(pdev)) {
2524
bus->width = e1000_bus_width_unknown;
2625
} else {
27-
pci_read_config_word(adapter->pdev,
28-
cap_offset + PCIE_LINK_STATUS,
29-
&pcie_link_status);
26+
pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &pcie_link_status);
3027
bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW,
3128
pcie_link_status);
3229
}

0 commit comments

Comments
 (0)