32 bit systems using 'struct timeval' will overflow in the year 2038, so we modify the code appropriately.
This patch replaces the use of struct timeval and do_gettimeofday() with ktime_get_real_seconds() which returns a 64 bit seconds value.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com --- drivers/block/sx8.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c index 59c91d4..cf87d9d 100644 --- a/drivers/block/sx8.c +++ b/drivers/block/sx8.c @@ -361,7 +361,7 @@ struct carm_msg_sync_time { u16 reserved1; __le32 handle; u32 reserved2; - __le32 timestamp; + __le64 timestamp; } __attribute__((packed));
struct carm_msg_get_fw_ver { @@ -671,16 +671,13 @@ static int carm_send_special (struct carm_host *host, carm_sspc_t func) static unsigned int carm_fill_sync_time(struct carm_host *host, unsigned int idx, void *mem) { - struct timeval tv; struct carm_msg_sync_time *st = mem;
- do_gettimeofday(&tv); - memset(st, 0, sizeof(*st)); st->type = CARM_MSG_MISC; st->subtype = MISC_SET_TIME; st->handle = cpu_to_le32(TAG_ENCODE(idx)); - st->timestamp = cpu_to_le32(tv.tv_sec); + st->timestamp = cpu_to_le64(ktime_get_real_seconds());
return sizeof(struct carm_msg_sync_time); }