32 bit systems using 'struct timeval' will break in the year 2038, so we replace the code appropriately. However, this driver is not broken in 2038 since we are using only the microseconds portion of the current time.
This patch replaces struct timeval and do_gettimeofday() with ktime_get_real_ns() which returns a 64 bit value which is safer than struct timeval. ktime_get_real_ns() is also faster than the computations done in this macro previously to get the same value.
Signed-off-by: Amitoj Kaur Chawla amitoj1606@gmail.com --- drivers/scsi/bfa/bfa_cs.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h index 91a8aa3..eeafef0 100644 --- a/drivers/scsi/bfa/bfa_cs.h +++ b/drivers/scsi/bfa/bfa_cs.h @@ -22,6 +22,7 @@ #ifndef __BFA_CS_H__ #define __BFA_CS_H__
+#include <linux/ktime.h> #include "bfad_drv.h"
/* @@ -32,13 +33,7 @@ #define BFA_TRC_MAX (4 * 1024) #endif
-#define BFA_TRC_TS(_trcm) \ - ({ \ - struct timeval tv; \ - \ - do_gettimeofday(&tv); \ - (tv.tv_sec*1000000+tv.tv_usec); \ - }) +#define BFA_TRC_TS(_trcm) (ktime_get_real_ns() / NSEC_PER_USEC)
#ifndef BFA_TRC_TS #define BFA_TRC_TS(_trcm) ((_trcm)->ticks++)