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: 124806 Delivered-To: patch@linaro.org Received: by 10.46.62.1 with SMTP id l1csp69044lja; Wed, 17 Jan 2018 06:50:39 -0800 (PST) X-Google-Smtp-Source: ACJfBov62qjfgx5XOxmsGR7Nu4dH1WLO/U7pBJEXCGMI3kYCO5DuLJVdm6OGwbn0d6dB6v7Q7Qjt X-Received: by 10.159.240.139 with SMTP id p11mr15071774plr.92.1516200639306; Wed, 17 Jan 2018 06:50:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516200639; cv=none; d=google.com; s=arc-20160816; b=bkRNJb7vzUd6dqjh1YqE1+ZDx2x9K+C4aK6rfClWXPIzt4nSSthFn319zWXqE7h0pP T/LejqnDKKupgktEr4JFhq81YCMibgW+V3nFKyxszZw8mFejVBtXH8af0F8ZhiHdlw1k e5iIgPUvCdVVtev0mqfoN2r6HRcc8Ws5n4d3vDVkgeTuiUEHdUX05nzhd5FI0vHYrJnb NLSTwHv9Xw4BYSjK7FnnQI7Yr8xq8MdtdqkA+lXHV8bYeI05PtPCP0gIRt1/xt0OINAY UCrgorks9ZUQclV8MFn8uj0sDLPIytnjEZMsK4qYie5gGpffr4vJnbkCncLfs6H/mHAs hgEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ERXnNXABhUGCFBRmiAe3jh1VHbbcJsqTfeC2O6iMaw0=; b=MneWCEh1lvhYia3dMPlCnTU7QijMKcfhgcKQmDauTJA1pq8nVRcbcbWhHODrg9H8jT uaByFaJMwEoLZmGXicauZMIR3tHBmTYIpl73jHBpNP8SpCCz318mffHooCWmyvLcWWi4 qYszrcPctK5oiewoCTaVGOph8ec6GGjcrLWuPHC1N74y4SwY7JxMr6WlWufSEFuoXhHX +5Zy/ARFwAJaHzFPbweo6mgV6gmmWROtlZrYCCMrmy3t30o17nyjN7jcMtbUegIIP0rZ RGXJ/FwnIbxFBYX2ROBC4Dpw9n+TRDRJqDNnud2dS6nycCjhORZRqjOmZ489RvK5+44s RLxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r130si3935425pgr.700.2018.01.17.06.50.39; Wed, 17 Jan 2018 06:50:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753408AbeAQOuh (ORCPT + 28 others); Wed, 17 Jan 2018 09:50:37 -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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.9.0 Signed-off-by: Arnd Bergmann Acked-by: Sumit Saxena 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);