From patchwork Fri Nov 10 15:37:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10053363 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 97E9C60631 for ; Fri, 10 Nov 2017 15:38:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 888B52B372 for ; Fri, 10 Nov 2017 15:38:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C1382B376; Fri, 10 Nov 2017 15:38:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA56B2B372 for ; Fri, 10 Nov 2017 15:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752929AbdKJPhv (ORCPT ); Fri, 10 Nov 2017 10:37:51 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:56196 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753141AbdKJPhs (ORCPT ); Fri, 10 Nov 2017 10:37:48 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0LtWNA-1fBVBR0dka-010qbA; Fri, 10 Nov 2017 16:37:33 +0100 From: Arnd Bergmann To: Anil Gurumurthy , Sudarsana Kalluru , "James E . J . Bottomley" , "Martin K . Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, y2038@lists.linaro.org, hch@lst.de, hare@suse.com, jthumshirn@suse.de, Arnd Bergmann Subject: [PATCH 5/7] scsi: bfa: replace bfa_get_log_time() with ktime_get_real_seconds() Date: Fri, 10 Nov 2017 16:37:13 +0100 Message-Id: <20171110153715.1929456-6-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20171110153715.1929456-1-arnd@arndb.de> References: <20171110153715.1929456-1-arnd@arndb.de> X-Provags-ID: V03:K0:rJFCtGg7+A3WsdfWGIvbkZngd3UuBd5eUYz+fENZaj4OhVbCjR3 455IJqNNjDStQBJAfhoPvv04lBib9WFLQJyP4YBtIMU7rpypK9+R8m/SN9wDiTD49hrkZFJ roTRhbPrBrFf//f4urpylmq7ET+hhJsjvqfDcYe6gxu0ea1XnAAGpt7EUz9CL+Hzdut8xx9 +EkWv7xBK1OL2QEo+Z3VA== X-UI-Out-Filterresults: notjunk:1; V01:K0:sZrt4+q72VY=:IwK6eTRRE8MUuar7/8WPF8 ukuvrAZeEi1BXUyrUevnclOichaQL8+dYx381aBjGvzEo8DuFS2Yqjvc09jfcCdvdaNB/+nL6 1zC0hCQDT5ulZ+LYWJAyfW2qhFlPZeEyrnPY+C9NM32VX1gqhhGIFU1+K/0OANmxkfwxAmrLa vJDqqsTPQ97ZJEJSQbgtM7lKfvUPoEZVH5u2lQ5n25nAs6dddEGC52ilUUzkgVQNeAYxEAXPW v+pbDAqM1HeV6xCc/X7bp+cFIQgsZMV4kGQPO7wO/RpFzzwpK138Qg2nJeyKvRawHdb9MLcjB tt+m5FPmBE/Qd8QA+w4J3OI6q7AtSxsL7ovLIp+4bihpnDpPCHWffBDru7QcJiAkckn+NYJV6 wPsG2OmzXIrVc3taThRgK1zf5OT9b2EEoZ/rTnuRw5Vszm9mLMQk04FycWNjPS5r5ws/JwZMV GiFajDeqgzJgnJZ6YJ1ILoSlGFq9VqIUKgl7YtKfw+cfyw72gRkSkqe/BvD/3go3XScdjpLzu IWPUkdCVX4dwWUdRKcJ7JMkkYAkGayDMUTBpQTRrDxSUudu3Jb4ZaF0mRPFfLWCBGDAh315kL 5SG/v0gzUyycQ0Jgjz66Tjb2masClxQuF3CN1HyhDlePTxpS7pEWJoyycZEGnNv76iN+d0RXA uwyFaVqzXhgAchCBQWYk0Fnj3os7RHDW4p1/D0pOi9PTvn21XFDNjhz6kE6K0rniIjMdPDUrV HT0dS9g63cro18u8qzF10ZMcmqO4CsqLXNkSIA== Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The bfa_get_log_time() returns a 64-bit timestamp that does not suffer from the y2038 overflow on 64-bit systems. However, on 32-bit architectures the timestamp will jump from 0x000000007fffffff to 0xffffffff80000000 in y2038 and produce wrong results. The ktime_get_real_seconds() function does the same thing as bfa_get_log_time() without that problem, so we can simply remove the former use ktime_get_real_seconds() instead. Signed-off-by: Arnd Bergmann --- drivers/scsi/bfa/bfa_svc.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/bfa/bfa_svc.c b/drivers/scsi/bfa/bfa_svc.c index dd7d1e6bc2d8..9d20d2c92e8c 100644 --- a/drivers/scsi/bfa/bfa_svc.c +++ b/drivers/scsi/bfa/bfa_svc.c @@ -288,18 +288,6 @@ plkd_validate_logrec(struct bfa_plog_rec_s *pl_rec) return 0; } -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; -} - static void bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) { @@ -320,7 +308,7 @@ bfa_plog_add(struct bfa_plog_s *plog, struct bfa_plog_rec_s *pl_rec) memcpy(pl_recp, pl_rec, sizeof(struct bfa_plog_rec_s)); - pl_recp->tv = bfa_get_log_time(); + pl_recp->tv = ktime_get_real_seconds(); BFA_PL_LOG_REC_INCR(plog->tail); if (plog->head == plog->tail) @@ -6141,13 +6129,13 @@ bfa_fcdiag_lb_is_running(struct bfa_s *bfa) /* * D-port */ -#define bfa_dport_result_start(__dport, __mode) do { \ - (__dport)->result.start_time = bfa_get_log_time(); \ - (__dport)->result.status = DPORT_TEST_ST_INPRG; \ - (__dport)->result.mode = (__mode); \ - (__dport)->result.rp_pwwn = (__dport)->rp_pwwn; \ - (__dport)->result.rp_nwwn = (__dport)->rp_nwwn; \ - (__dport)->result.lpcnt = (__dport)->lpcnt; \ +#define bfa_dport_result_start(__dport, __mode) do { \ + (__dport)->result.start_time = ktime_get_real_seconds(); \ + (__dport)->result.status = DPORT_TEST_ST_INPRG; \ + (__dport)->result.mode = (__mode); \ + (__dport)->result.rp_pwwn = (__dport)->rp_pwwn; \ + (__dport)->result.rp_nwwn = (__dport)->rp_nwwn; \ + (__dport)->result.lpcnt = (__dport)->lpcnt; \ } while (0) static bfa_boolean_t bfa_dport_send_req(struct bfa_dport_s *dport, @@ -6581,7 +6569,7 @@ bfa_dport_scn(struct bfa_dport_s *dport, struct bfi_diag_dport_scn_s *msg) switch (dport->i2hmsg.scn.state) { case BFI_DPORT_SCN_TESTCOMP: - dport->result.end_time = bfa_get_log_time(); + dport->result.end_time = ktime_get_real_seconds(); bfa_trc(dport->bfa, dport->result.end_time); dport->result.status = msg->info.testcomp.status; @@ -6628,7 +6616,7 @@ bfa_dport_scn(struct bfa_dport_s *dport, struct bfi_diag_dport_scn_s *msg) case BFI_DPORT_SCN_SUBTESTSTART: subtesttype = msg->info.teststart.type; dport->result.subtest[subtesttype].start_time = - bfa_get_log_time(); + ktime_get_real_seconds(); dport->result.subtest[subtesttype].status = DPORT_TEST_ST_INPRG;