bfa: Remove use of struct timeval
Subsystems (2)
PATCH 1/1 bfa: Remove use of struct timeval
struct timeval will have its tv_sec field overflow on 32-bit systems in year 2038 and beyond. This patch removes the usage of struct timeval and instead uses ktime_get_real_seconds() which returns 64-bit wall-clock seconds.
--- drivers/scsi/bfa/bfa_svc.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/scsi/bfa/bfa_svc.c +3 -9
@@ -14,6 +14,7 @@* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. */ +#include <linux/ktime.h> #include "bfad_drv.h" #include "bfad_im.h"
@@ -303,16 +304,9 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec)return 0 ; } -static u64 -bfa_get_log_time (void ) +static u64 bfa_get_log_time (void ) { -u64 system_time =0 ; -struct timeval tv; -do_gettimeofday (&tv); - -/* We are interested in seconds only. */ - system_time = tv.tv_sec; -return system_time; +return ktime_get_real_seconds (); } static void
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Quoted 7 lines · On Wednesday 04 February 2015 08:42:03 Tina Ruchandani wrote:
struct timeval will have its
tv_secfield overflow on 32-bit systems in year 2038 and beyond. This patch removes the usage of struct timeval and instead usesktime_get_real_seconds()which returns 64-bit wall-clock seconds.Signed-off-by Tina Ruchandani <[email protected]>
The patch is correct, but you can do it better by removing the bfa_get_log_time() function completely and changing the four callers to call ktime_get_real_seconds() directly.
The subject line could be improved too: you don't remember all uses of timeval in this patch, but only one of them. When you do the first change, a good subject line would be:
[SCSI] bfa: replace bfa_get_log_time with ktime_get_real_seconds
Arnd