From: Sumit Saxena <sumit.saxena@broadcom.com>
To: Arnd Bergmann <arnd@arndb.de>,
Kashyap Desai <kashyap.desai@broadcom.com>,
Shivasharan Srikanteshwara
<shivasharan.srikanteshwara@broadcom.com>,
"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Tomas Henzl <thenzl@redhat.com>, Hannes Reinecke <hare@suse.com>,
"PDL,MEGARAIDLINUX" <megaraidlinux.pdl@broadcom.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: RE: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time
Date: Thu, 18 Jan 2018 20:08:08 +0530 [thread overview]
Message-ID: <caab2d1d01798c79e62dd034ca3eafd5@mail.gmail.com> (raw)
In-Reply-To: <20180117144859.2382521-1-arnd@arndb.de>
-----Original Message-----
From: Arnd Bergmann [mailto:arnd@arndb.de]
Sent: Wednesday, January 17, 2018 8:19 PM
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
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 <arnd@arndb.de>
---
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);
Looks good to me.
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
--
2.9.0
next prev parent reply other threads:[~2018-01-18 14:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 14:48 [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time Arnd Bergmann
2018-01-18 14:38 ` Sumit Saxena [this message]
2018-01-19 2:31 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=caab2d1d01798c79e62dd034ca3eafd5@mail.gmail.com \
--to=sumit.saxena@broadcom.com \
--cc=arnd@arndb.de \
--cc=hare@suse.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=shivasharan.srikanteshwara@broadcom.com \
--cc=thenzl@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox