Skip to content

Commit 4c39e76

Browse files
ij-intelanguy11
authored andcommitted
e1000e: Use PCI_EXP_LNKSTA_NLW & FIELD_GET() instead of custom defines/code
e1000e has own copy of PCI Negotiated Link Width field defines. Use the ones from include/uapi/linux/pci_regs.h instead of the custom ones and remove the custom ones and convert to FIELD_GET(). Suggested-by: Jonathan Cameron <[email protected]> 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 4f60116 commit 4c39e76

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,6 @@
681681
#define PCIE_LINK_STATUS 0x12
682682

683683
#define PCI_HEADER_TYPE_MULTIFUNC 0x80
684-
#define PCIE_LINK_WIDTH_MASK 0x3F0
685-
#define PCIE_LINK_WIDTH_SHIFT 4
686684

687685
#define PHY_REVISION_MASK 0xFFFFFFF0
688686
#define MAX_PHY_REG_ADDRESS 0x1F /* 5 bit address bus (0-0x1F) */

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/* Copyright(c) 1999 - 2018 Intel Corporation. */
33

4+
#include <linux/bitfield.h>
5+
46
#include "e1000.h"
57

68
/**
@@ -25,9 +27,8 @@ s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw)
2527
pci_read_config_word(adapter->pdev,
2628
cap_offset + PCIE_LINK_STATUS,
2729
&pcie_link_status);
28-
bus->width = (enum e1000_bus_width)((pcie_link_status &
29-
PCIE_LINK_WIDTH_MASK) >>
30-
PCIE_LINK_WIDTH_SHIFT);
30+
bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW,
31+
pcie_link_status);
3132
}
3233

3334
mac->ops.set_lan_id(hw);

0 commit comments

Comments
 (0)