* [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time
@ 2018-01-17 14:48 Arnd Bergmann
2018-01-18 14:38 ` Sumit Saxena
2018-01-19 2:31 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2018-01-17 14:48 UTC (permalink / raw)
To: Kashyap Desai, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen
Cc: Arnd Bergmann, Tomas Henzl, Hannes Reinecke, megaraidlinux.pdl,
linux-scsi, linux-kernel
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);
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time
2018-01-17 14:48 [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time Arnd Bergmann
@ 2018-01-18 14:38 ` Sumit Saxena
2018-01-19 2:31 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Sumit Saxena @ 2018-01-18 14:38 UTC (permalink / raw)
To: Arnd Bergmann, Kashyap Desai, Shivasharan Srikanteshwara,
James E.J. Bottomley, Martin K. Petersen
Cc: Tomas Henzl, Hannes Reinecke, PDL,MEGARAIDLINUX, linux-scsi,
linux-kernel
-----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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time
2018-01-17 14:48 [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time Arnd Bergmann
2018-01-18 14:38 ` Sumit Saxena
@ 2018-01-19 2:31 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2018-01-19 2:31 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Kashyap Desai, Sumit Saxena, Shivasharan S, James E.J. Bottomley,
Martin K. Petersen, Tomas Henzl, Hannes Reinecke,
megaraidlinux.pdl, linux-scsi, linux-kernel
Arnd,
> 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.
Applied to 4.16/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-19 2:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-17 14:48 [PATCH] [RESEND] megaraid: use ktime_get_real for firmware time Arnd Bergmann
2018-01-18 14:38 ` Sumit Saxena
2018-01-19 2:31 ` Martin K. Petersen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.