Commit b45093dd authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Martin K. Petersen

scsi: megaraid: use ktime_get_real for firmware time

do_gettimeofday() overflows in 2038 on 32-bit architectures and is
deprecated, so convert this driver to call ktime_get_real()
directly. This also simplifies the calculation.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarSumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 22807aa8
...@@ -983,7 +983,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ...@@ -983,7 +983,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
MFI_CAPABILITIES *drv_ops; MFI_CAPABILITIES *drv_ops;
u32 scratch_pad_2; u32 scratch_pad_2;
unsigned long flags; unsigned long flags;
struct timeval tv; ktime_t time;
bool cur_fw_64bit_dma_capable; bool cur_fw_64bit_dma_capable;
fusion = instance->ctrl_context; fusion = instance->ctrl_context;
...@@ -1042,10 +1042,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) ...@@ -1042,10 +1042,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
IOCInitMessage->HostMSIxVectors = instance->msix_vectors; IOCInitMessage->HostMSIxVectors = instance->msix_vectors;
IOCInitMessage->HostPageSize = MR_DEFAULT_NVME_PAGE_SHIFT; IOCInitMessage->HostPageSize = MR_DEFAULT_NVME_PAGE_SHIFT;
do_gettimeofday(&tv); time = ktime_get_real();
/* Convert to milliseconds as per FW requirement */ /* Convert to milliseconds as per FW requirement */
IOCInitMessage->TimeStamp = cpu_to_le64((tv.tv_sec * 1000) + IOCInitMessage->TimeStamp = cpu_to_le64(ktime_to_ms(time));
(tv.tv_usec / 1000));
init_frame = (struct megasas_init_frame *)cmd->frame; init_frame = (struct megasas_init_frame *)cmd->frame;
memset(init_frame, 0, IOC_INIT_FRAME_SIZE); memset(init_frame, 0, IOC_INIT_FRAME_SIZE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment