Commit 23409bd4 authored by Tina Ruchandani's avatar Tina Ruchandani Committed by Martin K. Petersen

mpt3sas: Remove usage of 'struct timeval'

'struct timeval' will have its tv_sec value overflow on 32-bit systems
in year 2038 and beyond. This patch replaces the use of struct timeval
for computing mpi_request.TimeStamp, and instead uses ktime_t which
provides 64-bit seconds value. The timestamp computed remains
unaffected (milliseconds since Unix epoch).
Signed-off-by: default avatarTina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Acked-by: default avatarSathya Prakash <sathya.prakash@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e83596b4
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/ktime.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/aer.h> #include <linux/aer.h>
...@@ -4387,7 +4388,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) ...@@ -4387,7 +4388,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
Mpi2IOCInitRequest_t mpi_request; Mpi2IOCInitRequest_t mpi_request;
Mpi2IOCInitReply_t mpi_reply; Mpi2IOCInitReply_t mpi_reply;
int i, r = 0; int i, r = 0;
struct timeval current_time; ktime_t current_time;
u16 ioc_status; u16 ioc_status;
u32 reply_post_free_array_sz = 0; u32 reply_post_free_array_sz = 0;
Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL; Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL;
...@@ -4449,9 +4450,8 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag) ...@@ -4449,9 +4450,8 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
/* This time stamp specifies number of milliseconds /* This time stamp specifies number of milliseconds
* since epoch ~ midnight January 1, 1970. * since epoch ~ midnight January 1, 1970.
*/ */
do_gettimeofday(&current_time); current_time = ktime_get_real();
mpi_request.TimeStamp = cpu_to_le64((u64)current_time.tv_sec * 1000 + mpi_request.TimeStamp = cpu_to_le64(ktime_to_ms(current_time));
(current_time.tv_usec / 1000));
if (ioc->logging_level & MPT_DEBUG_INIT) { if (ioc->logging_level & MPT_DEBUG_INIT) {
__le32 *mfp; __le32 *mfp;
......
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