diff mbox series

[iwl-next,v1] igc: remove unused igc_update_nvm_checksum()

Message ID 20261024163701.134489-1-sashaneftin@gmail.com
State Under Review
Headers show
Series [iwl-next,v1] igc: remove unused igc_update_nvm_checksum() | expand

Commit Message

Sasha Neftin Oct. 24, 2026, 4:37 p.m. UTC
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.

Signed-off-by: Sasha Neftin <sashaneftin@gmail.com>
---
 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(-)

Comments

Paul Menzel Oct. 24, 2026, 4:40 p.m. UTC | #1
Dear Sasha,


Thank you for your patch.


Am 24.10.26 um 18:37 schrieb Sasha Neftin:
> 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?

> Signed-off-by: Sasha Neftin <sashaneftin@gmail.com>
> ---
>   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(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c b/drivers/net/ethernet/intel/igc/igc_i225.c
> index 5226d10cc95b..0971debca3a4 100644
> --- a/drivers/net/ethernet/intel/igc/igc_i225.c
> +++ b/drivers/net/ethernet/intel/igc/igc_i225.c
> @@ -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.
>    *
> diff --git a/drivers/net/ethernet/intel/igc/igc_nvm.c b/drivers/net/ethernet/intel/igc/igc_nvm.c
> index a47b8d39238c..b69889bfeb42 100644
> --- a/drivers/net/ethernet/intel/igc/igc_nvm.c
> +++ b/drivers/net/ethernet/intel/igc/igc_nvm.c
> @@ -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;
> -}
> diff --git a/drivers/net/ethernet/intel/igc/igc_nvm.h b/drivers/net/ethernet/intel/igc/igc_nvm.h
> index ab78d0c64547..d5f1f1a449eb 100644
> --- a/drivers/net/ethernet/intel/igc/igc_nvm.h
> +++ b/drivers/net/ethernet/intel/igc/igc_nvm.h
> @@ -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.


Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul
Loktionov, Aleksandr Oct. 26, 2026, 10:09 p.m. UTC | #2
> -----Original Message-----
> From: Sasha Neftin <sashaneftin@gmail.com>
> Sent: Saturday, October 24, 2026 6:37 PM
> To: intel-wired-lan@osuosl.org
> 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.
> 
> Signed-off-by: Sasha Neftin <sashaneftin@gmail.com>
> ---
>  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(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c
> b/drivers/net/ethernet/intel/igc/igc_i225.c
> index 5226d10cc95b..0971debca3a4 100644
> --- a/drivers/net/ethernet/intel/igc/igc_i225.c
> +++ b/drivers/net/ethernet/intel/igc/igc_i225.c
> @@ -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.
>   *
> diff --git a/drivers/net/ethernet/intel/igc/igc_nvm.c
> b/drivers/net/ethernet/intel/igc/igc_nvm.c
> index a47b8d39238c..b69889bfeb42 100644
> --- a/drivers/net/ethernet/intel/igc/igc_nvm.c
> +++ b/drivers/net/ethernet/intel/igc/igc_nvm.c
> @@ -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;
> -}
> diff --git a/drivers/net/ethernet/intel/igc/igc_nvm.h
> b/drivers/net/ethernet/intel/igc/igc_nvm.h
> index ab78d0c64547..d5f1f1a449eb 100644
> --- a/drivers/net/ethernet/intel/igc/igc_nvm.h
> +++ b/drivers/net/ethernet/intel/igc/igc_nvm.h
> @@ -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_ */
> --
> 2.53.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Sasha Neftin Oct. 27, 2026, 9:18 a.m. UTC | #3
On 10/24/2026 7:40 PM, Paul Menzel wrote:
> 
> 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.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igc/igc_i225.c b/drivers/net/ethernet/intel/igc/igc_i225.c
index 5226d10cc95b..0971debca3a4 100644
--- a/drivers/net/ethernet/intel/igc/igc_i225.c
+++ b/drivers/net/ethernet/intel/igc/igc_i225.c
@@ -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.
  *
diff --git a/drivers/net/ethernet/intel/igc/igc_nvm.c b/drivers/net/ethernet/intel/igc/igc_nvm.c
index a47b8d39238c..b69889bfeb42 100644
--- a/drivers/net/ethernet/intel/igc/igc_nvm.c
+++ b/drivers/net/ethernet/intel/igc/igc_nvm.c
@@ -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;
-}
diff --git a/drivers/net/ethernet/intel/igc/igc_nvm.h b/drivers/net/ethernet/intel/igc/igc_nvm.h
index ab78d0c64547..d5f1f1a449eb 100644
--- a/drivers/net/ethernet/intel/igc/igc_nvm.h
+++ b/drivers/net/ethernet/intel/igc/igc_nvm.h
@@ -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_ */