mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amitoj Kaur Chawla <amitoj1606@gmail.com>
To: anil.gurumurthy@qlogic.com, sudarsana.kalluru@qlogic.com,
	JBottomley@odin.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org, y2038@lists.linaro.org
Subject: [PATCH 6/6] scsi: bfa: bfa_cs: Remove struct timeval
Date: Sat, 9 Jan 2016 20:06:55 +0530	[thread overview]
Message-ID: <20160109143655.GA7594@amitoj-Inspiron-3542> (raw)

32 bit systems using 'struct timeval' will break in the year 2038, so
we replace the code appropriately.

This patch replaces struct timeval and do_gettimeofday() with
monotonic ktime_get_ns(). Since we are interested in microseconds
portion of the time, we can use NSEC_PER_USEC macro but this would
lead to expensive division for a frequently used function.

Alternatively a bit shift has been done which performs a division of
1024 instead of 1000 which slightly alters the value returned by this
function.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/scsi/bfa/bfa_cs.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/scsi/bfa/bfa_cs.h b/drivers/scsi/bfa/bfa_cs.h
index 91a8aa3..daee860 100644
--- a/drivers/scsi/bfa/bfa_cs.h
+++ b/drivers/scsi/bfa/bfa_cs.h
@@ -32,13 +32,7 @@
 #define BFA_TRC_MAX	(4 * 1024)
 #endif
 
-#define BFA_TRC_TS(_trcm)                               \
-	({                                              \
-		struct timeval tv;                      \
-							\
-		do_gettimeofday(&tv);                   \
-		(tv.tv_sec*1000000+tv.tv_usec);         \
-	})
+#define BFA_TRC_TS(_trcm)	(ktime_get_ns() >> 10)
 
 #ifndef BFA_TRC_TS
 #define BFA_TRC_TS(_trcm)	((_trcm)->ticks++)
-- 
1.9.1

                 reply	other threads:[~2016-01-09 14:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160109143655.GA7594@amitoj-Inspiron-3542 \
    --to=amitoj1606@gmail.com \
    --cc=JBottomley@odin.com \
    --cc=anil.gurumurthy@qlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sudarsana.kalluru@qlogic.com \
    --cc=y2038@lists.linaro.org \
    /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

all inboxes | Powered by JetHome®