]> git.itanic.dy.fi Git - linux-stable/commitdiff
e1000e: Use pcie_capability_read_word() for reading LNKSTA
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 21 Nov 2023 12:34:28 +0000 (14:34 +0200)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 12 Dec 2023 20:21:29 +0000 (12:21 -0800)
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 <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/e1000e/defines.h
drivers/net/ethernet/intel/e1000e/mac.c

index a4d29c9e03a6b18a19cd01498e4cfceeefae5992..23a58cada43ae1628bce1a36a4b87a3f6d382d99 100644 (file)
 
 /* PCI/PCI-X/PCI-EX Config space */
 #define PCI_HEADER_TYPE_REGISTER     0x0E
-#define PCIE_LINK_STATUS             0x12
 
 #define PCI_HEADER_TYPE_MULTIFUNC    0x80
 
index 5340cf73778d25398181e459f44c779783f6c3b1..8c3d9c5962f21cd7bb1d0ea55f536ff4ce6f8957 100644 (file)
  **/
 s32 e1000e_get_bus_info_pcie(struct e1000_hw *hw)
 {
+       struct pci_dev *pdev = hw->adapter->pdev;
        struct e1000_mac_info *mac = &hw->mac;
        struct e1000_bus_info *bus = &hw->bus;
-       struct e1000_adapter *adapter = hw->adapter;
-       u16 pcie_link_status, cap_offset;
+       u16 pcie_link_status;
 
-       cap_offset = adapter->pdev->pcie_cap;
-       if (!cap_offset) {
+       if (!pci_pcie_cap(pdev)) {
                bus->width = e1000_bus_width_unknown;
        } else {
-               pci_read_config_word(adapter->pdev,
-                                    cap_offset + PCIE_LINK_STATUS,
-                                    &pcie_link_status);
+               pcie_capability_read_word(pdev, PCI_EXP_LNKSTA, &pcie_link_status);
                bus->width = (enum e1000_bus_width)FIELD_GET(PCI_EXP_LNKSTA_NLW,
                                                             pcie_link_status);
        }