Skip to contentSkip to conversation

scsi: bfa: bfad_bsg: Use ktime_get_real_seconds()

PATCH In review Amitoj Kaur Chawla 2 participants 2 messages Oct 27, 2015 – Nov 3, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scsi: bfa: bfad_bsg: Use ktime_get_real_seconds()

32 bit systems using 'struct timeval' will break 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().

---
Changes in v2:
-Removed trailing whitespace

 drivers/scsi/bfa/bfad_bsg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/bfa/bfad_bsg.c +3 -3
index 023b9d4..92f5b0f 100644
@@ -15,6 +15,7 @@
  * General Public License for more details.
  */
 
+#include <linux/ktime.h>
 #include <linux/uaccess.h>
 #include "bfad_drv.h"
 #include "bfad_im.h"
@@ -2093,13 +2094,12 @@ bfad_iocmd_fcpim_cfg_profile(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
 {
 	struct bfa_bsg_fcpim_profile_s *iocmd =
 				(struct bfa_bsg_fcpim_profile_s *)cmd;
-	struct timeval  tv;
 	unsigned long	flags;
 
-	do_gettimeofday(&tv);
 	spin_lock_irqsave(&bfad->bfad_lock, flags);
 	if (v_cmd == IOCMD_FCPIM_PROFILE_ON)
-		iocmd->status = bfa_fcpim_profile_on(&bfad->bfa, tv.tv_sec);
+		iocmd->status = bfa_fcpim_profile_on(&bfad->bfa,
+						ktime_get_real_seconds());
 	else if (v_cmd == IOCMD_FCPIM_PROFILE_OFF)
 		iocmd->status = bfa_fcpim_profile_off(&bfad->bfa);
 	spin_unlock_irqrestore(&bfad->bfad_lock, flags);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines · On Tuesday 27 October 2015 13:29:01 Amitoj Kaur Chawla wrote:

32 bit systems using 'struct timeval' will break 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().

I just replied to v1 of this patch, as mentioned there I think it needs more work, to pass the time as time64_t where possible instead of implicitly casting to u32.

Arnd