Mon Aug 27 13:57:50 2018 UTC ()
Define nsecs_to_jiffies.


(riastradh)
diff -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/jiffies.h

cvs diff -r1.11 -r1.12 src/sys/external/bsd/drm2/include/linux/jiffies.h (expand / switch to unified diff)

--- src/sys/external/bsd/drm2/include/linux/jiffies.h 2018/08/27 07:05:13 1.11
+++ src/sys/external/bsd/drm2/include/linux/jiffies.h 2018/08/27 13:57:50 1.12
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: jiffies.h,v 1.11 2018/08/27 07:05:13 riastradh Exp $ */ 1/* $NetBSD: jiffies.h,v 1.12 2018/08/27 13:57:50 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Taylor R. Campbell. 8 * by Taylor R. Campbell.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -49,26 +49,34 @@ get_jiffies_64(void) @@ -49,26 +49,34 @@ get_jiffies_64(void)
49} 49}
50 50
51static inline uint64_t 51static inline uint64_t
52nsecs_to_jiffies64(uint64_t nsec) 52nsecs_to_jiffies64(uint64_t nsec)
53{ 53{
54 54
55 /* XXX Arbitrary cutoff, should review the arithmetic. */ 55 /* XXX Arbitrary cutoff, should review the arithmetic. */
56 if (((1000000000 % hz) == 0) || (nsec >= 20000000000ul)) 56 if (((1000000000 % hz) == 0) || (nsec >= 20000000000ul))
57 return (nsec/1000000000)*hz; 57 return (nsec/1000000000)*hz;
58 else 58 else
59 return (nsec*hz)/1000000000; 59 return (nsec*hz)/1000000000;
60} 60}
61 61
 62static inline uint32_t
 63nsecs_to_jiffies(uint64_t nsec)
 64{
 65
 66 /* XXX Not sure what else to do but truncate... */
 67 return (uint32_t)nsecs_to_jiffies64(nsec);
 68}
 69
62static inline unsigned int 70static inline unsigned int
63msecs_to_jiffies(unsigned int msec) 71msecs_to_jiffies(unsigned int msec)
64{ 72{
65 return mstohz(msec); 73 return mstohz(msec);
66} 74}
67 75
68static inline unsigned int 76static inline unsigned int
69jiffies_to_msecs(unsigned int j) 77jiffies_to_msecs(unsigned int j)
70{ 78{
71 return hztoms(j); 79 return hztoms(j);
72} 80}
73 81
74static inline unsigned int 82static inline unsigned int