Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/drm2/include/linux Rework nsecs_to_jiffies64.



details:   https://anonhg.NetBSD.org/src/rev/4bf7aa467a84
branches:  trunk
changeset: 992420:4bf7aa467a84
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 06:18:41 2018 +0000

description:
Rework nsecs_to_jiffies64.

diffstat:

 sys/external/bsd/drm2/include/linux/jiffies.h |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (26 lines):

diff -r 08641fefce00 -r 4bf7aa467a84 sys/external/bsd/drm2/include/linux/jiffies.h
--- a/sys/external/bsd/drm2/include/linux/jiffies.h     Mon Aug 27 06:18:30 2018 +0000
+++ b/sys/external/bsd/drm2/include/linux/jiffies.h     Mon Aug 27 06:18:41 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: jiffies.h,v 1.7 2018/08/27 06:18:30 riastradh Exp $    */
+/*     $NetBSD: jiffies.h,v 1.8 2018/08/27 06:18:41 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -42,9 +42,14 @@
 #define        MAX_JIFFY_OFFSET        ((INT_MAX >> 1) - 1)
 
 static inline uint64_t
-nsecs_to_jiffies64(unsigned int msec)
+nsecs_to_jiffies64(uint64_t nsec)
 {
-       return 1000000*mstohz(msec);
+
+       /* XXX Arbitrary cutoff, should review the arithmetic.  */
+       if (((1000000000 % hz) == 0) || (ns >= 20000000000ul))
+               return (nsec/1000000000)*hz;
+       else
+               return (nsec*hz)/1000000000;
 }
 
 static inline unsigned int



Home | Main Index | Thread Index | Old Index