linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ktime.h: Introduce ktime_ms_delta
       [not found] <ktime_ms_delta>
@ 2014-12-17  5:11 ` Chunyan Zhang
  2014-12-18  7:53   ` Arnd Bergmann
  2015-01-23 10:48   ` [tip:timers/core] " tip-bot for Chunyan Zhang
  0 siblings, 2 replies; 3+ messages in thread
From: Chunyan Zhang @ 2014-12-17  5:11 UTC (permalink / raw)
  To: tglx, davem, john.stultz, dborkman; +Cc: arnd, linux-kernel, zhang.lyra

This patch adds a reusable time difference function which returns the
difference in millisecond, as often used in some driver code, e.g.
mtd/test, media/rc, etc.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
---
 include/linux/ktime.h |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index c9d645a..891ea92 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -186,6 +186,11 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
        return ktime_to_us(ktime_sub(later, earlier));
 }
 
+static inline s64 ktime_ms_delta(const ktime_t later, const ktime_t earlier)
+{
+	return ktime_to_ms(ktime_sub(later, earlier));
+}
+
 static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
 {
 	return ktime_add_ns(kt, usec * NSEC_PER_USEC);
-- 
1.7.9.5


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

* Re: [PATCH] ktime.h: Introduce ktime_ms_delta
  2014-12-17  5:11 ` [PATCH] ktime.h: Introduce ktime_ms_delta Chunyan Zhang
@ 2014-12-18  7:53   ` Arnd Bergmann
  2015-01-23 10:48   ` [tip:timers/core] " tip-bot for Chunyan Zhang
  1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2014-12-18  7:53 UTC (permalink / raw)
  To: Chunyan Zhang
  Cc: tglx, davem, john.stultz, dborkman, linux-kernel, zhang.lyra

On Wednesday 17 December 2014 13:11:35 Chunyan Zhang wrote:
> This patch adds a reusable time difference function which returns the
> difference in millisecond, as often used in some driver code, e.g.
> mtd/test, media/rc, etc.
> 
> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>

Acked-by: Arnd Bergmann <arnd@linaro.org>

Very nice!

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

* [tip:timers/core] ktime.h: Introduce ktime_ms_delta
  2014-12-17  5:11 ` [PATCH] ktime.h: Introduce ktime_ms_delta Chunyan Zhang
  2014-12-18  7:53   ` Arnd Bergmann
@ 2015-01-23 10:48   ` tip-bot for Chunyan Zhang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Chunyan Zhang @ 2015-01-23 10:48 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: arnd, linux-kernel, hpa, zhang.chunyan, mingo, tglx

Commit-ID:  41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
Gitweb:     http://git.kernel.org/tip/41fbf3b39d5eca01527338b4d0ee15ee1ae1023c
Author:     Chunyan Zhang <zhang.chunyan@linaro.org>
AuthorDate: Wed, 17 Dec 2014 13:11:35 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 23 Jan 2015 11:47:15 +0100

ktime.h: Introduce ktime_ms_delta

This patch adds a reusable time difference function which returns the
difference in millisecond, as often used in some driver code, e.g.
mtd/test, media/rc, etc.

Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Acked-by: Arnd Bergmann <arnd@linaro.org>
Cc: zhang.lyra@gmail.com
Cc: davem@davemloft.net
Cc: john.stultz@linaro.org
Cc: dborkman@redhat.com
Link: http://lkml.kernel.org/r/1418793095-18780-1-git-send-email-zhang.chunyan@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/ktime.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index c9d645a..891ea92 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -186,6 +186,11 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
        return ktime_to_us(ktime_sub(later, earlier));
 }
 
+static inline s64 ktime_ms_delta(const ktime_t later, const ktime_t earlier)
+{
+	return ktime_to_ms(ktime_sub(later, earlier));
+}
+
 static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
 {
 	return ktime_add_ns(kt, usec * NSEC_PER_USEC);

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

end of thread, other threads:[~2015-01-23 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <ktime_ms_delta>
2014-12-17  5:11 ` [PATCH] ktime.h: Introduce ktime_ms_delta Chunyan Zhang
2014-12-18  7:53   ` Arnd Bergmann
2015-01-23 10:48   ` [tip:timers/core] " tip-bot for Chunyan Zhang

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).