/* Performs checksum calculation and validates the EEPROM checksum. If the caller does not need checksum_val, the value can be NULL.  */
s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, u16 *checksum_val)
/* Performs checksum calculation and validates the EEPROM checksum. If the caller does not need checksum_val, the value can be NULL.  */
s32 ixgbe_validate_eeprom_checksum_generic(struct ixgbe_hw *hw, u16 *checksum_val)
{
	s32 status;
	u16 checksum;
	u16 read_checksum = 0;
	status = hw->eeprom.ops.read(hw, 0, &checksum);
	if (status == 0) {
		checksum = ixgbe_calc_eeprom_checksum(hw);
		hw->eeprom.ops.read(hw, IXGBE_EEPROM_CHECKSUM, &read_checksum);
		if (read_checksum != checksum)
			status = IXGBE_ERR_EEPROM_CHECKSUM;
		if (checksum_val)
			*checksum_val = checksum;
	} else {
		hw_dbg(hw, "EEPROM read failed\n");
	}
	return status;
}