* [PATCH] [SCSI] bfa: Remove use of struct timeval
@ 2015-02-04 3:12 Tina Ruchandani
2015-02-04 15:07 ` Arnd Bergmann
0 siblings, 1 reply; 2+ messages in thread
From: Tina Ruchandani @ 2015-02-04 3:12 UTC (permalink / raw)
To: linux-scsi
Cc: Arnd Bergmann, James E.J. Bottomley, Anil Gurumurthy,
Sudarsana Kalluru
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.
Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
---
drivers/scsi/bfa/bfa_svc.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c
index 625225f..5554461 100644
--- a/drivers/scsi/bfa/bfa_svc.c
+++ b/drivers/scsi/bfa/bfa_svc.c
@@ -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
--
2.2.0.rc0.207.ga3a616c
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] [SCSI] bfa: Remove use of struct timeval
2015-02-04 3:12 [PATCH] [SCSI] bfa: Remove use of struct timeval Tina Ruchandani
@ 2015-02-04 15:07 ` Arnd Bergmann
0 siblings, 0 replies; 2+ messages in thread
From: Arnd Bergmann @ 2015-02-04 15:07 UTC (permalink / raw)
To: Tina Ruchandani
Cc: linux-scsi, James E.J. Bottomley, Anil Gurumurthy,
Sudarsana Kalluru
On Wednesday 04 February 2015 08:42:03 Tina Ruchandani wrote:
> 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.
>
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
>
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-02-04 15:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04 3:12 [PATCH] [SCSI] bfa: Remove use of struct timeval Tina Ruchandani
2015-02-04 15:07 ` Arnd Bergmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox