Skip to contentSkip to conversation

igc: remove unused igc_update_nvm_checksum()

PATCH In review Sasha Neftin 4 participants 5 messages Oct 24 – Nov 22

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

PATCH 1/1 igc: remove unused igc_update_nvm_checksum()

igc_update_nvm_checksum() has no callers in the tree. The i225 NVM operations use their own implementation, igc_update_nvm_checksum_i225(), which is what nvm->ops.update points to in igc_init_nvm_params_i225().

Remove the dead generic function and its prototype from igc_nvm.h. While at it, add the include guard name as a comment to the closing #endif in igc_nvm.h.

No functional change.

---
 drivers/net/ethernet/intel/igc/igc_i225.c |  4 +--
 drivers/net/ethernet/intel/igc/igc_nvm.c  | 31 -----------------------
 drivers/net/ethernet/intel/igc/igc_nvm.h  |  3 +--
 3 files changed, 3 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/igc/igc_i225.c +2 -2
index 5226d10cc95b..0971debca3a4 100644
@@ -220,7 +220,7 @@ static s32 igc_read_nvm_srrd_i225(struct igc_hw *hw, u16 offset, u16 words,
  *
  * Writes data to Shadow Ram at offset using EEWR register.
  *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function , the
  * Shadow Ram will most likely contain an invalid checksum.
  */
 static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
@@ -275,7 +275,7 @@ static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
  *
  * Writes data to Shadow RAM at offset using EEWR register.
  *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function , the
  * data will not be committed to FLASH and also Shadow RAM will most likely
  * contain an invalid checksum.
  *
drivers/net/ethernet/intel/igc/igc_nvm.c +0 -31
index a47b8d39238c..b69889bfeb42 100644
@@ -132,34 +132,3 @@ s32 igc_validate_nvm_checksum(struct igc_hw *hw)
 out:
 	return ret_val;
 }
-
-/**
- * igc_update_nvm_checksum - Update EEPROM checksum
- * @hw: pointer to the HW structure
- *
- * Updates the EEPROM checksum by reading/adding each word of the EEPROM
- * up to the checksum.  Then calculates the EEPROM checksum and writes the
- * value to the EEPROM.
- */
-s32 igc_update_nvm_checksum(struct igc_hw *hw)
-{
-	u16 checksum = 0;
-	u16 i, nvm_data;
-	s32  ret_val;
-
-	for (i = 0; i < NVM_CHECKSUM_REG; i++) {
-		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
-		if (ret_val) {
-			hw_dbg("NVM Read Error while updating checksum.\n");
-			goto out;
-		}
-		checksum += nvm_data;
-	}
-	checksum = NVM_SUM - checksum;
-	ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
-	if (ret_val)
-		hw_dbg("NVM Write Error while updating checksum.\n");
-
-out:
-	return ret_val;
-}
drivers/net/ethernet/intel/igc/igc_nvm.h +1 -2
index ab78d0c64547..d5f1f1a449eb 100644
@@ -7,6 +7,5 @@
 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);
-s32 igc_update_nvm_checksum(struct igc_hw *hw);
 
-#endif
+#endif /* _IGC_NVM_H_ */
Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw

Dear Sasha,

Thank you for your patch.

Am 24.10.26 um 18:37 schrieb Sasha Neftin:

Quoted 9 lines

igc_update_nvm_checksum() has no callers in the tree. The i225 NVM operations use their own implementation, igc_update_nvm_checksum_i225(), which is what nvm->ops.update points to in igc_init_nvm_params_i225().

Remove the dead generic function and its prototype from igc_nvm.h. While at it, add the include guard name as a comment to the closing #endif in igc_nvm.h.

No functional change.

Add a Fixes: tag, so it’s easier to review the change, making the function unused?

Quoted 73 lines
---
  drivers/net/ethernet/intel/igc/igc_i225.c |  4 +--
  drivers/net/ethernet/intel/igc/igc_nvm.c  | 31 -----------------------
  drivers/net/ethernet/intel/igc/igc_nvm.h  |  3 +--
  3 files changed, 3 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/igc/igc_i225.c +2 -2
index 5226d10cc95b..0971debca3a4 100644
@@ -220,7 +220,7 @@ static s32 igc_read_nvm_srrd_i225(struct igc_hw *hw, u16 offset, u16 words,
   *
   * Writes data to Shadow Ram at offset using EEWR register.
   *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function , the
   * Shadow Ram will most likely contain an invalid checksum.
   */
  static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
@@ -275,7 +275,7 @@ static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
   *
   * Writes data to Shadow RAM at offset using EEWR register.
   *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function , the
   * data will not be committed to FLASH and also Shadow RAM will most likely
   * contain an invalid checksum.
   *
drivers/net/ethernet/intel/igc/igc_nvm.c +0 -31
index a47b8d39238c..b69889bfeb42 100644
@@ -132,34 +132,3 @@ s32 igc_validate_nvm_checksum(struct igc_hw *hw)
  out:
  	return ret_val;
  }
-
-/**
- * igc_update_nvm_checksum - Update EEPROM checksum
- * @hw: pointer to the HW structure
- *
- * Updates the EEPROM checksum by reading/adding each word of the EEPROM
- * up to the checksum.  Then calculates the EEPROM checksum and writes the
- * value to the EEPROM.
- */
-s32 igc_update_nvm_checksum(struct igc_hw *hw)
-{
-	u16 checksum = 0;
-	u16 i, nvm_data;
-	s32  ret_val;
-
-	for (i = 0; i < NVM_CHECKSUM_REG; i++) {
-		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
-		if (ret_val) {
-			hw_dbg("NVM Read Error while updating checksum.\n");
-			goto out;
-		}
-		checksum += nvm_data;
-	}
-	checksum = NVM_SUM - checksum;
-	ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
-	if (ret_val)
-		hw_dbg("NVM Write Error while updating checksum.\n");
-
-out:
-	return ret_val;
-}
drivers/net/ethernet/intel/igc/igc_nvm.h +0 -0
index ab78d0c64547..d5f1f1a449eb 100644

drivers/net/ethernet/intel/igc/igc_nvm.h line 11

Quoted 7 lines
drivers/net/ethernet/intel/igc/igc_nvm.h +1 -2
@@ -7,6 +7,5 @@
  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);
-s32 igc_update_nvm_checksum(struct igc_hw *hw);
 
-#endif
+#endif /* _IGC_NVM_H_ */

I’d prefer a separate change, but clean-up commits are frowned upon in this subsystem.

Kind regards,

Paul

#2 lore raw
Quoted 3 lines · Paul Menzel

Add a Fixes: tag, so it’s easier to review the change, making the function unused?

This patch has no functional change and targets next-queue, so a Fixes tag isn't needed.

Reviewed-by on v1 1/1
#3 lore raw
In reply to Sasha Neftin
Quoted 110 lines

-----Original Message-----
From: Sasha Neftin <[email protected]>
Sent: Saturday, October 24, 2026 6:37 PM
To: [email protected]
Subject: [iwl-next, v1] igc: remove unused igc_update_nvm_checksum()

igc_update_nvm_checksum() has no callers in the tree. The i225 NVM operations use their own implementation, igc_update_nvm_checksum_i225(), which is what nvm->ops.update points to in igc_init_nvm_params_i225().

Remove the dead generic function and its prototype from igc_nvm.h. While at it, add the include guard name as a comment to the closing #endif in igc_nvm.h.

No functional change.

---
 drivers/net/ethernet/intel/igc/igc_i225.c |  4 +--
drivers/net/ethernet/intel/igc/igc_nvm.c  | 31 -----------------------
drivers/net/ethernet/intel/igc/igc_nvm.h  |  3 +--
 3 files changed, 3 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/igc/igc_i225.c +4 -2
index 5226d10cc95b..0971debca3a4 100644
@@ -220,7 +220,7 @@ static s32 igc_read_nvm_srrd_i225(struct igc_hw *hw,
 u16 offset, u16 words,
  *
  * Writes data to Shadow Ram at offset using EEWR register.
  *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function ,
+ the
  * Shadow Ram will most likely contain an invalid checksum.
  */
 static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
@@ -275,7 +275,7 @@ static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16
 offset, u16 words,
  *
  * Writes data to Shadow RAM at offset using EEWR register.
  *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function ,
+ the
  * data will not be committed to FLASH and also Shadow RAM will most

likely
* contain an invalid checksum.
*

drivers/net/ethernet/intel/igc/igc_nvm.c +0 -6
index a47b8d39238c..b69889bfeb42 100644
@@ -132,34 +132,3 @@ s32 igc_validate_nvm_checksum(struct igc_hw *hw)
 out:
 	return ret_val;
 }
-
-/**
- * igc_update_nvm_checksum - Update EEPROM checksum
- * @hw: pointer to the HW structure
- *
- * Updates the EEPROM checksum by reading/adding each word of the

EEPROM
- * up to the checksum. Then calculates the EEPROM checksum and writes the
- * value to the EEPROM.
- */

drivers/net/ethernet/intel/igc/igc_nvm.c +0 -9
-s32 igc_update_nvm_checksum(struct igc_hw *hw) -{
-	u16 checksum = 0;
-	u16 i, nvm_data;
-	s32  ret_val;
-
-	for (i = 0; i < NVM_CHECKSUM_REG; i++) {
-		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
-		if (ret_val) {
-			hw_dbg("NVM Read Error while updating

checksum.\n");

drivers/net/ethernet/intel/igc/igc_nvm.c +0 -12
-			goto out;
-		}
-		checksum += nvm_data;
-	}
-	checksum = NVM_SUM - checksum;
-	ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
-	if (ret_val)
-		hw_dbg("NVM Write Error while updating checksum.\n");
-
-out:
-	return ret_val;
-}
drivers/net/ethernet/intel/igc/igc_nvm.h +1 -3
index ab78d0c64547..d5f1f1a449eb 100644
@@ -7,6 +7,5 @@
 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);
-s32 igc_update_nvm_checksum(struct igc_hw *hw);
 
-#endif
+#endif /* _IGC_NVM_H_ */
--
Quoted 1 line

2.53.0

Tested-by
#4 lore raw
Quoted 107 lines · Aleksandr
Quoted 107 lines

-----Original Message-----
From: Sasha Neftin <[email protected]>
Sent: Saturday, October 24, 2026 6:37 PM
To: [email protected]
Subject: [iwl-next, v1] igc: remove unused igc_update_nvm_checksum()

igc_update_nvm_checksum() has no callers in the tree. The i225 NVM operations use their own implementation, igc_update_nvm_checksum_i225(), which is what nvm->ops.update points to in igc_init_nvm_params_i225().

Remove the dead generic function and its prototype from igc_nvm.h. While at it, add the include guard name as a comment to the closing #endif in igc_nvm.h.

No functional change.

---
  drivers/net/ethernet/intel/igc/igc_i225.c |  4 +--
drivers/net/ethernet/intel/igc/igc_nvm.c  | 31 -----------------------
drivers/net/ethernet/intel/igc/igc_nvm.h  |  3 +--
  3 files changed, 3 insertions(+), 35 deletions(-)
drivers/net/ethernet/intel/igc/igc_i225.c +4 -2
index 5226d10cc95b..0971debca3a4 100644
@@ -220,7 +220,7 @@ static s32 igc_read_nvm_srrd_i225(struct igc_hw *hw,
 u16 offset, u16 words,
   *
   * Writes data to Shadow Ram at offset using EEWR register.
   *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function ,
+ the
   * Shadow Ram will most likely contain an invalid checksum.
   */
  static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16 offset, u16 words,
@@ -275,7 +275,7 @@ static s32 igc_write_nvm_srwr(struct igc_hw *hw, u16
 offset, u16 words,
   *
   * Writes data to Shadow RAM at offset using EEWR register.
   *
- * If igc_update_nvm_checksum is not called after this function , the
+ * If igc_update_nvm_checksum_i225 is not called after this function ,
+ the
   * data will not be committed to FLASH and also Shadow RAM will most

likely
* contain an invalid checksum.
*

drivers/net/ethernet/intel/igc/igc_nvm.c +0 -6
index a47b8d39238c..b69889bfeb42 100644
@@ -132,34 +132,3 @@ s32 igc_validate_nvm_checksum(struct igc_hw *hw)
  out:
  	return ret_val;
  }
-
-/**
- * igc_update_nvm_checksum - Update EEPROM checksum
- * @hw: pointer to the HW structure
- *
- * Updates the EEPROM checksum by reading/adding each word of the

EEPROM
- * up to the checksum. Then calculates the EEPROM checksum and writes the
- * value to the EEPROM.
- */

drivers/net/ethernet/intel/igc/igc_nvm.c +0 -9
-s32 igc_update_nvm_checksum(struct igc_hw *hw) -{
-	u16 checksum = 0;
-	u16 i, nvm_data;
-	s32  ret_val;
-
-	for (i = 0; i < NVM_CHECKSUM_REG; i++) {
-		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
-		if (ret_val) {
-			hw_dbg("NVM Read Error while updating

checksum.\n");

drivers/net/ethernet/intel/igc/igc_nvm.c +0 -12
-			goto out;
-		}
-		checksum += nvm_data;
-	}
-	checksum = NVM_SUM - checksum;
-	ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
-	if (ret_val)
-		hw_dbg("NVM Write Error while updating checksum.\n");
-
-out:
-	return ret_val;
-}
drivers/net/ethernet/intel/igc/igc_nvm.h +0 -1
index ab78d0c64547..d5f1f1a449eb 100644
@@ -7,6 +7,5 @@
  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);
-s32 igc_update_nvm_checksum(struct igc_hw *hw);
 
Quoted 6 lines
Quoted 4 lines
drivers/net/ethernet/intel/igc/igc_nvm.h +1 -2
-#endif
+#endif /* _IGC_NVM_H_ */
--

2.53.0