linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mpt3sas: Remove usage of 'struct timeval'
@ 2016-04-13  7:01 Tina Ruchandani
  2016-04-15  2:48 ` Martin K. Petersen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tina Ruchandani @ 2016-04-13  7:01 UTC (permalink / raw)
  To: MPT-FusionLinux.pdl; +Cc: Arnd Bergmann, y2038, linux-scsi, linux-kernel, jejb

'struct timeval' will have its tv_sec value overflow on 32-bit systems
in year 2038 and beyond. This patch replaces the use of struct timeval
for computing mpi_request.TimeStamp, and instead uses ktime_t which provides
64-bit seconds value. The timestamp computed remains unaffected (milliseconds
since Unix epoch).

Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 8c44b9c..326c152 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -57,6 +57,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/time.h>
+#include <linux/ktime.h>
 #include <linux/kthread.h>
 #include <linux/aer.h>

@@ -4387,7 +4388,7 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
 	Mpi2IOCInitRequest_t mpi_request;
 	Mpi2IOCInitReply_t mpi_reply;
 	int i, r = 0;
-	struct timeval current_time;
+	ktime_t current_time;
 	u16 ioc_status;
 	u32 reply_post_free_array_sz = 0;
 	Mpi2IOCInitRDPQArrayEntry *reply_post_free_array = NULL;
@@ -4449,9 +4450,8 @@ _base_send_ioc_init(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
 	/* This time stamp specifies number of milliseconds
 	 * since epoch ~ midnight January 1, 1970.
 	 */
-	do_gettimeofday(&current_time);
-	mpi_request.TimeStamp = cpu_to_le64((u64)current_time.tv_sec * 1000 +
-	    (current_time.tv_usec / 1000));
+	current_time = ktime_get_real();
+	mpi_request.TimeStamp = cpu_to_le64(ktime_to_ms(current_time));

 	if (ioc->logging_level & MPT_DEBUG_INIT) {
 		__le32 *mfp;
--
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mpt3sas: Remove usage of 'struct timeval'
  2016-04-13  7:01 [PATCH] mpt3sas: Remove usage of 'struct timeval' Tina Ruchandani
@ 2016-04-15  2:48 ` Martin K. Petersen
  2016-04-15 17:43   ` Sathya Prakash Veerichetty
  2016-04-15  7:16 ` Johannes Thumshirn
  2016-04-15 20:20 ` Martin K. Petersen
  2 siblings, 1 reply; 5+ messages in thread
From: Martin K. Petersen @ 2016-04-15  2:48 UTC (permalink / raw)
  To: Tina Ruchandani
  Cc: MPT-FusionLinux.pdl, Arnd Bergmann, y2038, linux-scsi,
	linux-kernel, jejb, suganath-prabu.subramani, Chaitra P B,
	Sreekanth Reddy

>>>>> "Tina" == Tina Ruchandani <ruchandani.tina@gmail.com> writes:

Tina> 'struct timeval' will have its tv_sec value overflow on 32-bit
Tina> systems in year 2038 and beyond. This patch replaces the use of
Tina> struct timeval for computing mpi_request.TimeStamp, and instead
Tina> uses ktime_t which provides 64-bit seconds value. The timestamp
Tina> computed remains unaffected (milliseconds since Unix epoch).

Broadcom folks, please review.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mpt3sas: Remove usage of 'struct timeval'
  2016-04-13  7:01 [PATCH] mpt3sas: Remove usage of 'struct timeval' Tina Ruchandani
  2016-04-15  2:48 ` Martin K. Petersen
@ 2016-04-15  7:16 ` Johannes Thumshirn
  2016-04-15 20:20 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2016-04-15  7:16 UTC (permalink / raw)
  To: Tina Ruchandani
  Cc: MPT-FusionLinux.pdl, Arnd Bergmann, y2038, linux-scsi,
	linux-kernel, jejb

On Mittwoch, 13. April 2016 00:01:40 CEST Tina Ruchandani wrote:
> 'struct timeval' will have its tv_sec value overflow on 32-bit systems
> in year 2038 and beyond. This patch replaces the use of struct timeval
> for computing mpi_request.TimeStamp, and instead uses ktime_t which provides
> 64-bit seconds value. The timestamp computed remains unaffected (milliseconds
> since Unix epoch).
> 
> Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> ---

Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                                                                Storage
jthumshirn@suse.de                                                             +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] mpt3sas: Remove usage of 'struct timeval'
  2016-04-15  2:48 ` Martin K. Petersen
@ 2016-04-15 17:43   ` Sathya Prakash Veerichetty
  0 siblings, 0 replies; 5+ messages in thread
From: Sathya Prakash Veerichetty @ 2016-04-15 17:43 UTC (permalink / raw)
  To: Martin K. Petersen, Tina Ruchandani
  Cc: PDL-MPT-FUSIONLINUX, Arnd Bergmann, y2038, linux-scsi,
	linux-kernel, jejb, suganath-prabu.subramani, Chaitra Basappa,
	Sreekanth Reddy

Hi,
Please consider this patch as Ack-by: Sathya Prakash
<sathya.prakash@broadcom.com>

Thanks,
Sathya

-----Original Message-----
From: mpt-fusionlinux.pdl@broadcom.com
[mailto:mpt-fusionlinux.pdl@broadcom.com] On Behalf Of Martin K. Petersen
Sent: Thursday, April 14, 2016 8:48 PM
To: Tina Ruchandani
Cc: MPT-FusionLinux.pdl@broadcom.com; Arnd Bergmann;
y2038@lists.linaro.org; linux-scsi@vger.kernel.org;
linux-kernel@vger.kernel.org; jejb@linux.vnet.ibm.com;
suganath-prabu.subramani@avagotech.com; Chaitra P B; Sreekanth Reddy
Subject: Re: [PATCH] mpt3sas: Remove usage of 'struct timeval'

>>>>> "Tina" == Tina Ruchandani <ruchandani.tina@gmail.com> writes:

Tina> 'struct timeval' will have its tv_sec value overflow on 32-bit
Tina> systems in year 2038 and beyond. This patch replaces the use of
Tina> struct timeval for computing mpi_request.TimeStamp, and instead
Tina> uses ktime_t which provides 64-bit seconds value. The timestamp
Tina> computed remains unaffected (milliseconds since Unix epoch).

Broadcom folks, please review.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mpt3sas: Remove usage of 'struct timeval'
  2016-04-13  7:01 [PATCH] mpt3sas: Remove usage of 'struct timeval' Tina Ruchandani
  2016-04-15  2:48 ` Martin K. Petersen
  2016-04-15  7:16 ` Johannes Thumshirn
@ 2016-04-15 20:20 ` Martin K. Petersen
  2 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2016-04-15 20:20 UTC (permalink / raw)
  To: Tina Ruchandani
  Cc: MPT-FusionLinux.pdl, Arnd Bergmann, y2038, linux-scsi,
	linux-kernel, jejb, Sathya Prakash, Johannes Thumshirn

>>>>> "Tina" == Tina Ruchandani <ruchandani.tina@gmail.com> writes:

Tina> 'struct timeval' will have its tv_sec value overflow on 32-bit
Tina> systems in year 2038 and beyond. This patch replaces the use of
Tina> struct timeval for computing mpi_request.TimeStamp, and instead
Tina> uses ktime_t which provides 64-bit seconds value. The timestamp
Tina> computed remains unaffected (milliseconds since Unix epoch).

Applied to 4.7/scsi-queue.

Thank you!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-04-15 20:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13  7:01 [PATCH] mpt3sas: Remove usage of 'struct timeval' Tina Ruchandani
2016-04-15  2:48 ` Martin K. Petersen
2016-04-15 17:43   ` Sathya Prakash Veerichetty
2016-04-15  7:16 ` Johannes Thumshirn
2016-04-15 20:20 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).