aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ktime.h
diff options
context:
space:
mode:
authorLiu Ying <Ying.Liu@freescale.com>2013-05-07 04:38:40 -0400
committerJohn Stultz <john.stultz@linaro.org>2013-05-28 17:00:57 -0400
commita44b8bd6072ac82fc49af941de8c1ac85d94852d (patch)
tree4a22da9a515052ac2f87af4129353fed206f80f9 /include/linux/ktime.h
parent1eaff67266b6b6c97bbd33cf2c20577822836413 (diff)
ktime: Use macro NSEC_PER_USEC where appropriate
We've got the macro NSEC_PER_USEC defined in header file include/linux/time.h. To make the code decent, this patch replaces the immediate number 1000 to convert bewteen a time value in microseconds and one in nanoseconds with the macro NSEC_PER_USEC. Signed-off-by: Liu Ying <Ying.Liu@freescale.com> Cc: David S. Miller <davem@davemloft.net> Cc: Daniel Borkmann <dborkman@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/ktime.h')
-rw-r--r--include/linux/ktime.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index bbca12804d12..608728a164a9 100644
--- a/include/linux/ktime.h
+++ b/include/linux/ktime.h
@@ -229,7 +229,8 @@ static inline ktime_t timespec_to_ktime(const struct timespec ts)
229static inline ktime_t timeval_to_ktime(const struct timeval tv) 229static inline ktime_t timeval_to_ktime(const struct timeval tv)
230{ 230{
231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec, 231 return (ktime_t) { .tv = { .sec = (s32)tv.tv_sec,
232 .nsec = (s32)tv.tv_usec * 1000 } }; 232 .nsec = (s32)(tv.tv_usec *
233 NSEC_PER_USEC) } };
233} 234}
234 235
235/** 236/**
@@ -320,12 +321,12 @@ static inline s64 ktime_us_delta(const ktime_t later, const ktime_t earlier)
320 321
321static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec) 322static inline ktime_t ktime_add_us(const ktime_t kt, const u64 usec)
322{ 323{
323 return ktime_add_ns(kt, usec * 1000); 324 return ktime_add_ns(kt, usec * NSEC_PER_USEC);
324} 325}
325 326
326static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) 327static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec)
327{ 328{
328 return ktime_sub_ns(kt, usec * 1000); 329 return ktime_sub_ns(kt, usec * NSEC_PER_USEC);
329} 330}
330 331
331extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs); 332extern ktime_t ktime_add_safe(const ktime_t lhs, const ktime_t rhs);