Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: bfa: use ktime_get_real_ts64 for firmware timestamp

BFA_TRC_TS() calculates a 32-bit microsecond timestamp using the
deprecated do_gettimeofday() function. This overflows roughly every 71
minutes, so it's obviously not used as an absolute time stamp, but it
seems wrong to use a time base for it that will jump during
settimeofday() calls, leap seconds, or the y2038 overflow.

This converts it to ktime_get_ts64(), which has none of those problems
but is not synchronized to wall-clock time.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Anil Gurumurthy <Anil.Gurumurthy@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Arnd Bergmann and committed by
Martin K. Petersen
7e75f607 2c798236

+3 -3
+3 -3
drivers/scsi/bfa/bfa_cs.h
··· 35 35 36 36 #define BFA_TRC_TS(_trcm) \ 37 37 ({ \ 38 - struct timeval tv; \ 38 + struct timespec64 ts; \ 39 39 \ 40 - do_gettimeofday(&tv); \ 41 - (tv.tv_sec*1000000+tv.tv_usec); \ 40 + ktime_get_ts64(&ts); \ 41 + (ts.tv_sec*1000000+ts.tv_nsec / 1000); \ 42 42 }) 43 43 44 44 #ifndef BFA_TRC_TS