Skip to contentSkip to conversation

igc deadcoding

PATCH Applied [email protected] 4 participants 9 messages Jan 2, 2025 – Jan 6, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover igc deadcoding

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This set removes some functions that are entirely unused
and have been since ~2018.

Build tested.

(Repost now netdev is open)

Dr. David Alan Gilbert (3):
igc: Remove unused igc_acquire/release_nvm
igc: Remove unused igc_read/write_pci_cfg wrappers
igc: Remove unused igc_read/write_pcie_cap_reg

 drivers/net/ethernet/intel/igc/igc_hw.h   |  5 ---
 drivers/net/ethernet/intel/igc/igc_main.c | 39 ------------------
 drivers/net/ethernet/intel/igc/igc_nvm.c  | 50 -----------------------
 drivers/net/ethernet/intel/igc/igc_nvm.h  |  2 -
 4 files changed, 96 deletions(-)
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/3 igc: Remove unused igc_acquire/release_nvm

From: "Dr. David Alan Gilbert" <[email protected]>

igc_acquire_nvm() and igc_release_nvm() were added in 2018 as part of commit ab4056126813 ("igc: Add NVM support")

but never used.

Remove them.

The igc_1225.c has it's own specific implementations.

---
 drivers/net/ethernet/intel/igc/igc_nvm.c | 50 ------------------------
 drivers/net/ethernet/intel/igc/igc_nvm.h |  2 -
 2 files changed, 52 deletions(-)
drivers/net/ethernet/intel/igc/igc_nvm.c +0 -50
index 58f81aba0144..efd121c03967 100644
@@ -35,56 +35,6 @@ static s32 igc_poll_eerd_eewr_done(struct igc_hw *hw, int ee_reg)
 	return ret_val;
 }
 
-/**
- * igc_acquire_nvm - Generic request for access to EEPROM
- * @hw: pointer to the HW structure
- *
- * Set the EEPROM access request bit and wait for EEPROM access grant bit.
- * Return successful if access grant bit set, else clear the request for
- * EEPROM access and return -IGC_ERR_NVM (-1).
- */
-s32 igc_acquire_nvm(struct igc_hw *hw)
-{
-	s32 timeout = IGC_NVM_GRANT_ATTEMPTS;
-	u32 eecd = rd32(IGC_EECD);
-	s32 ret_val = 0;
-
-	wr32(IGC_EECD, eecd | IGC_EECD_REQ);
-	eecd = rd32(IGC_EECD);
-
-	while (timeout) {
-		if (eecd & IGC_EECD_GNT)
-			break;
-		udelay(5);
-		eecd = rd32(IGC_EECD);
-		timeout--;
-	}
-
-	if (!timeout) {
-		eecd &= ~IGC_EECD_REQ;
-		wr32(IGC_EECD, eecd);
-		hw_dbg("Could not acquire NVM grant\n");
-		ret_val = -IGC_ERR_NVM;
-	}
-
-	return ret_val;
-}
-
-/**
- * igc_release_nvm - Release exclusive access to EEPROM
- * @hw: pointer to the HW structure
- *
- * Stop any current commands to the EEPROM and clear the EEPROM request bit.
- */
-void igc_release_nvm(struct igc_hw *hw)
-{
-	u32 eecd;
-
-	eecd = rd32(IGC_EECD);
-	eecd &= ~IGC_EECD_REQ;
-	wr32(IGC_EECD, eecd);
-}
-
 /**
  * igc_read_nvm_eerd - Reads EEPROM using EERD register
  * @hw: pointer to the HW structure
drivers/net/ethernet/intel/igc/igc_nvm.h +0 -2
index f9fc2e9cfb03..ab78d0c64547 100644
@@ -4,8 +4,6 @@
 #ifndef _IGC_NVM_H_
 #define _IGC_NVM_H_
 
-s32 igc_acquire_nvm(struct igc_hw *hw);
-void igc_release_nvm(struct igc_hw *hw);
 s32 igc_read_mac_addr(struct igc_hw *hw);
 s32 igc_read_nvm_eerd(struct igc_hw *hw, u16 offset, u16 words, u16 *data);
 s32 igc_validate_nvm_checksum(struct igc_hw *hw);
Signature · 1 line
2.47.1
Reviewed-by on v1 1/3
#2 lore raw

Re: [Intel-wired-lan] [PATCH net-next 1/3] igc: Remove unused igc_acquire/release_nvm

Quoted 5 lines · On 1/2/2025 7:41 PM, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

igc_acquire_nvm() and igc_release_nvm() were added in 2018 as part of commit ab4056126813 ("igc: Add NVM support")

Quoted 7 lines

but never used.

Remove them.

The igc_1225.c has it's own specific implementations.

Quoted 80 lines
---
  drivers/net/ethernet/intel/igc/igc_nvm.c | 50 ------------------------
  drivers/net/ethernet/intel/igc/igc_nvm.h |  2 -
  2 files changed, 52 deletions(-)
drivers/net/ethernet/intel/igc/igc_nvm.c +0 -50
index 58f81aba0144..efd121c03967 100644
@@ -35,56 +35,6 @@ static s32 igc_poll_eerd_eewr_done(struct igc_hw *hw, int ee_reg)
  	return ret_val;
  }
 
-/**
- * igc_acquire_nvm - Generic request for access to EEPROM
- * @hw: pointer to the HW structure
- *
- * Set the EEPROM access request bit and wait for EEPROM access grant bit.
- * Return successful if access grant bit set, else clear the request for
- * EEPROM access and return -IGC_ERR_NVM (-1).
- */
-s32 igc_acquire_nvm(struct igc_hw *hw)
-{
-	s32 timeout = IGC_NVM_GRANT_ATTEMPTS;
-	u32 eecd = rd32(IGC_EECD);
-	s32 ret_val = 0;
-
-	wr32(IGC_EECD, eecd | IGC_EECD_REQ);
-	eecd = rd32(IGC_EECD);
-
-	while (timeout) {
-		if (eecd & IGC_EECD_GNT)
-			break;
-		udelay(5);
-		eecd = rd32(IGC_EECD);
-		timeout--;
-	}
-
-	if (!timeout) {
-		eecd &= ~IGC_EECD_REQ;
-		wr32(IGC_EECD, eecd);
-		hw_dbg("Could not acquire NVM grant\n");
-		ret_val = -IGC_ERR_NVM;
-	}
-
-	return ret_val;
-}
-
-/**
- * igc_release_nvm - Release exclusive access to EEPROM
- * @hw: pointer to the HW structure
- *
- * Stop any current commands to the EEPROM and clear the EEPROM request bit.
- */
-void igc_release_nvm(struct igc_hw *hw)
-{
-	u32 eecd;
-
-	eecd = rd32(IGC_EECD);
-	eecd &= ~IGC_EECD_REQ;
-	wr32(IGC_EECD, eecd);
-}
-
  /**
   * igc_read_nvm_eerd - Reads EEPROM using EERD register
   * @hw: pointer to the HW structure
drivers/net/ethernet/intel/igc/igc_nvm.h +0 -2
index f9fc2e9cfb03..ab78d0c64547 100644
@@ -4,8 +4,6 @@
  #ifndef _IGC_NVM_H_
  #define _IGC_NVM_H_
 
-s32 igc_acquire_nvm(struct igc_hw *hw);
-void igc_release_nvm(struct igc_hw *hw);
  s32 igc_read_mac_addr(struct igc_hw *hw);
  s32 igc_read_nvm_eerd(struct igc_hw *hw, u16 offset, u16 words, u16 *data);
  s32 igc_validate_nvm_checksum(struct igc_hw *hw);
#3 lore raw

PATCH 2/3 igc: Remove unused igc_read/write_pci_cfg wrappers

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

igc_read_pci_cfg() and igc_write_pci_cfg were added in 2018 as part of commit 146740f9abc4 ("igc: Add support for PF")
but have remained unused.

Remove them.

---
 drivers/net/ethernet/intel/igc/igc_hw.h   |  2 --
 drivers/net/ethernet/intel/igc/igc_main.c | 14 --------------
 2 files changed, 16 deletions(-)
drivers/net/ethernet/intel/igc/igc_hw.h +0 -2
index d9d1a1a11daf..7ec7e395020b 100644
@@ -281,7 +281,5 @@ struct net_device *igc_get_hw_dev(struct igc_hw *hw);
 
 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);
-void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
-void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
 
 #endif /* _IGC_HW_H_ */
drivers/net/ethernet/intel/igc/igc_main.c +0 -14
index 27872bdea9bd..9c92673a7240 100644
@@ -6780,20 +6780,6 @@ static const struct net_device_ops igc_netdev_ops = {
 };
 
 /* PCIe configuration access */
-void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	pci_read_config_word(adapter->pdev, reg, value);
-}
-
-void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	pci_write_config_word(adapter->pdev, reg, *value);
-}
-
 s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
 {
 	struct igc_adapter *adapter = hw->back;
Signature · 1 line
2.47.1
Reviewed-by on v1 2/3
#4 lore raw

Re: [Intel-wired-lan] [PATCH net-next 2/3] igc: Remove unused igc_read/write_pci_cfg wrappers

Quoted 9 lines · On 1/2/2025 7:41 PM, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

igc_read_pci_cfg() and igc_write_pci_cfg were added in 2018 as part of commit 146740f9abc4 ("igc: Add support for PF")
but have remained unused.

Remove them.

Quoted 43 lines
---
  drivers/net/ethernet/intel/igc/igc_hw.h   |  2 --
  drivers/net/ethernet/intel/igc/igc_main.c | 14 --------------
  2 files changed, 16 deletions(-)
drivers/net/ethernet/intel/igc/igc_hw.h +0 -2
index d9d1a1a11daf..7ec7e395020b 100644
@@ -281,7 +281,5 @@ struct net_device *igc_get_hw_dev(struct igc_hw *hw);
 
  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);
-void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
-void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value);
 
  #endif /* _IGC_HW_H_ */
drivers/net/ethernet/intel/igc/igc_main.c +0 -14
index 27872bdea9bd..9c92673a7240 100644
@@ -6780,20 +6780,6 @@ static const struct net_device_ops igc_netdev_ops = {
  };
 
  /* PCIe configuration access */
-void igc_read_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	pci_read_config_word(adapter->pdev, reg, value);
-}
-
-void igc_write_pci_cfg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	pci_write_config_word(adapter->pdev, reg, *value);
-}
-
  s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
  {
  	struct igc_adapter *adapter = hw->back;
#5 lore raw

PATCH 3/3 igc: Remove unused igc_read/write_pcie_cap_reg

In reply to [email protected]

From: "Dr. David Alan Gilbert" <[email protected]>

The last uses of igc_read_pcie_cap_reg() and igc_write_pcie_cap_reg() were removed in 2019 by
commit 16ecd8d9af26 ("igc: Remove the obsolete workaround")

Remove them.

---
 drivers/net/ethernet/intel/igc/igc_hw.h   |  3 ---
 drivers/net/ethernet/intel/igc/igc_main.c | 25 -----------------------
 2 files changed, 28 deletions(-)
drivers/net/ethernet/intel/igc/igc_hw.h +0 -3
index 7ec7e395020b..be8a49a86d09 100644
@@ -279,7 +279,4 @@ struct net_device *igc_get_hw_dev(struct igc_hw *hw);
 #define hw_dbg(format, arg...) \
 	netdev_dbg(igc_get_hw_dev(hw), format, ##arg)
 
-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);
-
 #endif /* _IGC_HW_H_ */
drivers/net/ethernet/intel/igc/igc_main.c +0 -25
index 9c92673a7240..f58cd6940434 100644
@@ -6779,31 +6779,6 @@ static const struct net_device_ops igc_netdev_ops = {
 	.ndo_get_tstamp		= igc_get_tstamp,
 };
 
-/* PCIe configuration access */
-s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	if (!pci_is_pcie(adapter->pdev))
-		return -IGC_ERR_CONFIG;
-
-	pcie_capability_read_word(adapter->pdev, reg, value);
-
-	return IGC_SUCCESS;
-}
-
-s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	if (!pci_is_pcie(adapter->pdev))
-		return -IGC_ERR_CONFIG;
-
-	pcie_capability_write_word(adapter->pdev, reg, *value);
-
-	return IGC_SUCCESS;
-}
-
 u32 igc_rd32(struct igc_hw *hw, u32 reg)
 {
 	struct igc_adapter *igc = container_of(hw, struct igc_adapter, hw);
Signature · 1 line
2.47.1
Reviewed-by on v1 3/3
#6 lore raw

Re: [Intel-wired-lan] [PATCH net-next 3/3] igc: Remove unused igc_read/write_pcie_cap_reg

Quoted 9 lines · On 1/2/2025 7:41 PM, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

The last uses of igc_read_pcie_cap_reg() and igc_write_pcie_cap_reg() were removed in 2019 by
commit 16ecd8d9af26 ("igc: Remove the obsolete workaround")

Remove them.

Quoted 54 lines
---
  drivers/net/ethernet/intel/igc/igc_hw.h   |  3 ---
  drivers/net/ethernet/intel/igc/igc_main.c | 25 -----------------------
  2 files changed, 28 deletions(-)
drivers/net/ethernet/intel/igc/igc_hw.h +0 -3
index 7ec7e395020b..be8a49a86d09 100644
@@ -279,7 +279,4 @@ struct net_device *igc_get_hw_dev(struct igc_hw *hw);
  #define hw_dbg(format, arg...) \
  	netdev_dbg(igc_get_hw_dev(hw), format, ##arg)
 
-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);
-
  #endif /* _IGC_HW_H_ */
drivers/net/ethernet/intel/igc/igc_main.c +0 -25
index 9c92673a7240..f58cd6940434 100644
@@ -6779,31 +6779,6 @@ static const struct net_device_ops igc_netdev_ops = {
  	.ndo_get_tstamp		= igc_get_tstamp,
  };
 
-/* PCIe configuration access */
-s32 igc_read_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	if (!pci_is_pcie(adapter->pdev))
-		return -IGC_ERR_CONFIG;
-
-	pcie_capability_read_word(adapter->pdev, reg, value);
-
-	return IGC_SUCCESS;
-}
-
-s32 igc_write_pcie_cap_reg(struct igc_hw *hw, u32 reg, u16 *value)
-{
-	struct igc_adapter *adapter = hw->back;
-
-	if (!pci_is_pcie(adapter->pdev))
-		return -IGC_ERR_CONFIG;
-
-	pcie_capability_write_word(adapter->pdev, reg, *value);
-
-	return IGC_SUCCESS;
-}
-
  u32 igc_rd32(struct igc_hw *hw, u32 reg)
  {
  	struct igc_adapter *igc = container_of(hw, struct igc_adapter, hw);
maintainer Reviewed-by on the v1 series
#7 lore raw
In reply to [email protected]
Quoted 10 lines · On 1/2/2025 9:41 AM, [email protected] wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This set removes some functions that are entirely unused
and have been since ~2018.

Build tested.

(Repost now netdev is open)

Quoted 11 lines

Dr. David Alan Gilbert (3):
igc: Remove unused igc_acquire/release_nvm
igc: Remove unused igc_read/write_pci_cfg wrappers
igc: Remove unused igc_read/write_pcie_cap_reg

  drivers/net/ethernet/intel/igc/igc_hw.h   |  5 ---
  drivers/net/ethernet/intel/igc/igc_main.c | 39 ------------------
  drivers/net/ethernet/intel/igc/igc_nvm.c  | 50 -----------------------
  drivers/net/ethernet/intel/igc/igc_nvm.h  |  2 -
  4 files changed, 96 deletions(-)
#8 lore raw
In reply to [email protected]
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Thu, 2 Jan 2025 17:41:39 +0000 you wrote:

From: "Dr. David Alan Gilbert" <[email protected]>

Hi,
This set removes some functions that are entirely unused
and have been since ~2018.

Build tested.

[...]

Here is the summary with links:
- [net-next,1/3] igc: Remove unused igc_acquire/release_nvm

    https://git.kernel.org/netdev/net-next/c/b37dba891b17
  - [net-next,2/3] igc: Remove unused igc_read/write_pci_cfg wrappers
    https://git.kernel.org/netdev/net-next/c/121c3c6bc661
  - [net-next,3/3] igc: Remove unused igc_read/write_pcie_cap_reg
    https://git.kernel.org/netdev/net-next/c/c75889081366

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html