From patchwork Wed Jan 17 14:48:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10169413 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 D3AC9603ED for ; Wed, 17 Jan 2018 14:50:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C464126223 for ; Wed, 17 Jan 2018 14:50:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8772269A3; Wed, 17 Jan 2018 14:50:50 +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 49F1526223 for ; Wed, 17 Jan 2018 14:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753361AbeAQOug (ORCPT ); Wed, 17 Jan 2018 09:50:36 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:60575 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753051AbeAQOuf (ORCPT ); Wed, 17 Jan 2018 09:50:35 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPA (Nemesis) id 0LtFKF-1ezEne0vCV-012lZl; Wed, 17 Jan 2018 15:49:01 +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 , megaraidlinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time Date: Wed, 17 Jan 2018 15:48:51 +0100 Message-Id: <20180117144859.2382521-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:Zn+jvlBmhtix5WVp3Vmq+2Mc4lOTO8wj9Gai+IEycKMYQZA8Rda GHRWSDt0k4DGrGPl2RXaAaZoxLYI+fUR9KQp3Ho1mAYTLDyn1JvyWxA8RJCc2dYqdamexCn aPC34tAAzaCjZ4Pn84msFYIX3nsD43ecqPho+SzT5PfiR9OdU75A8bQ3QjHZ66NEgemXPyh S1ZXYVGW9hw18xGyaNgww== X-UI-Out-Filterresults: notjunk:1; V01:K0:AcXC5lQ3r6A=:GQeBpaz30WtT+STEyYw0Zy TqwoBN/y711Wa6/9yBP3KfGt3pZKEEAr4qF42hraEIZM3t/owoJ0zr/GVm9aqj+wVthv3DC2r TPfsg7FN1COqc9T5YSMQU0pmlA+qwoZZpX3xA201WwcP1EIeeKKmovyNoqULlCUpYFtig8XWo Dk3GhGO8Z5vrMW4N27JNG363zsAA16Br//zrbiq+dRSxbaE15f80Iac2OlUdagtxIvc0LlnAC dfMI+w8ag6ZJLpPOvpD2xOQUakQs/SBaF6S7uwKfLVLVeXWocj0Fr0CyknZLZYF3L03yICLA8 tfPC+POynlz47WR0vXYnWCUX//iTOcH3tL7enowkTtxsxWA30xUkeCtTLJbZz++XYEt+s+++C zfI/ziiBQ2bfGSVGgY2DfcJg2mqtumJGWGqVhmBWwGu4L17vMTbt8AG+1vUtBUfnPuZRqF74C DDHDFSlW9zTwZywumfauu2m8CamkwmlMw5X5CVPR8l/8OdNEqYCwLMnYBSIntdR1Q/8CRqKzd /AecI7CbSdQwsf3BcIg8qrgu0312AfwU5/zb4H+S7bph3xp5skt8IcTzh4E/nyxWwB2JRoaZz wINlUoV/Qy5W/6Ng680quQ6mid1jAVzVv1GEaC/qd4AKvq7djEbnkeYsJtK/5BbVsXkYISEau WAn4v1P607rVtzqAQ3qXB8JNrfbivuy+FKHh+OnscCOlksITGJY6i5qr6D/kKmpLEi7LryKeH 0mjPdRQ1s8XHrAcZ9Zk7zTSpVdO0vuTKCWgb/g== 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 --- Sent originally in Nov 2017, no comments. Please apply --- 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 0a85f3c48ef6..97fae28c8374 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, IOC_INIT_FRAME_SIZE);