From patchwork Fri Nov 10 15:41:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10053391 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 E094D60631 for ; Fri, 10 Nov 2017 15:41:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D10BB2AF05 for ; Fri, 10 Nov 2017 15:41:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C5E4A2AF1C; Fri, 10 Nov 2017 15:41:56 +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 7B04B2AF05 for ; Fri, 10 Nov 2017 15:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753068AbdKJPln (ORCPT ); Fri, 10 Nov 2017 10:41:43 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:53810 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbdKJPlm (ORCPT ); Fri, 10 Nov 2017 10:41:42 -0500 Received: from wuerfel.lan ([109.193.157.232]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.129]) with ESMTPA (Nemesis) id 0MQYgq-1eedw71hFc-00Tks2; Fri, 10 Nov 2017 16:41:23 +0100 From: Arnd Bergmann To: Kashyap Desai , Sumit Saxena , Shivasharan S , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Tomas Henzl , Hannes Reinecke , Sasikumar Chandrasekaran , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] megaraid: use ktime_get_real for firmware time Date: Fri, 10 Nov 2017 16:41:15 +0100 Message-Id: <20171110154121.1934289-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:nAPoKIshCH19cr753qGFyMwNuSa5h0AbnLzMUYqo74adzfSUXZ/ bxyEKFhAuPpkuMHdqEVlUC4TJwoUtKjHaGo5pLO69VBQ8DXqSu7VD1VBkRGExOuTK25NbvV ySfeLcooby0DrUQxUw+shumR1AZbFuOUFbd2RpDJWRpTMsjSFECmOWJo5Q/AMvYPhb9lZmA SjBBeIwG28d7aYE3V/o9w== X-UI-Out-Filterresults: notjunk:1; V01:K0:E8dhMhT9Nuw=:R16FwfEmnex1tqpVYUrfVI nDyfucQfv+G/ghFy+uLXqke2L4tnuU4I6ZUgvyo7Rs+U85T7zaULDuFIRqxNM3tatHtcBky/U j6RsNRWFP3IXrG+RFEyGNA9iGuJpVaJWHpVHBPnjpiKCgOmN2yfje5aORAogV54xDNZ+GYH+k rknIzRj+4lVa2EqZfULdouFAWHKu0EDHR1bExdjwYfOAozDvhfya4u45IfelXa1+3qWj+OGTr TKmVTSvas7bmpvvzJkQLK1Cxm/3xvxwPbVLZZwV9Ni/Sfnc9D0tgu8IM2t8k2nxfhWSZxrpsf nUih+SgCFTf3BEj6xpbyIbkpfdBH5aHQbA0TVfBZbD41Sj1/8RRD6UORZx45LoakkSTf+b8uJ gPewuKSU9P4c7Rv2O0rkcP57nR7gko7ZKPQQfRWgSd8lpBTyfthOnrwVDQweqvc+P1PJ3BJgt HEEHeyno9v9bNlJO0dIllWQtJusoeBweTnB9Rj5f6bQY2Owt6krJ6oBxe4iZ+mrcY+xJXmLi/ 4AC6+8J5F/fIEOuLpagceXUSDg6UoqZ5fx0k/QgCgN5+jprywDTfOUQf4CFZ6wsQad1GOUk7q CMNyN/KXfC7iyWdJDnXDqGNOyVxaycOFS6Ab+kHOdBSbcTPjqiEArBl5xOPoZA5Sc3IZAWOYv U8zK/JS/K3xS7guBmm0R6t9vRpSUTbIOwGHhvaqniRnDJIvx2QfDOHrEbQKLSlbV3kM1Uxm6h MKrws8AKJQfif/yf/S7oK040/iYXcNNEmVwanw== 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 do_gettimeofday() overflows in 2038 on 32-bit architectures and is deprecated, so convert this driver to call ktime_get_real() directly. This also simplifies the calculation. Signed-off-by: Arnd Bergmann --- drivers/scsi/megaraid/megaraid_sas_fusion.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c index 65dc4fea6352..b8ada27d84a4 100644 --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c @@ -983,7 +983,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) MFI_CAPABILITIES *drv_ops; u32 scratch_pad_2; unsigned long flags; - struct timeval tv; + ktime_t time; bool cur_fw_64bit_dma_capable; fusion = instance->ctrl_context; @@ -1042,10 +1042,9 @@ megasas_ioc_init_fusion(struct megasas_instance *instance) IOCInitMessage->HostMSIxVectors = instance->msix_vectors; IOCInitMessage->HostPageSize = MR_DEFAULT_NVME_PAGE_SHIFT; - do_gettimeofday(&tv); + time = ktime_get_real(); /* Convert to milliseconds as per FW requirement */ - IOCInitMessage->TimeStamp = cpu_to_le64((tv.tv_sec * 1000) + - (tv.tv_usec / 1000)); + IOCInitMessage->TimeStamp = cpu_to_le64(ktime_to_ms(time)); init_frame = (struct megasas_init_frame *)cmd->frame; memset(init_frame, 0, MEGAMFI_FRAME_SIZE);