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 Use tvtohz instead of ad...
details: https://anonhg.NetBSD.org/src/rev/fe4920e0ad7c
branches: trunk
changeset: 330990:fe4920e0ad7c
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Jul 26 14:24:08 2014 +0000
description:
Use tvtohz instead of ad-hacking it myself, suggested by apb@.
diffstat:
sys/external/bsd/drm2/include/linux/jiffies.h | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diffs (34 lines):
diff -r 633fb92378f3 -r fe4920e0ad7c sys/external/bsd/drm2/include/linux/jiffies.h
--- a/sys/external/bsd/drm2/include/linux/jiffies.h Sat Jul 26 13:24:34 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/jiffies.h Sat Jul 26 14:24:08 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: jiffies.h,v 1.5 2014/07/26 06:20:25 riastradh Exp $ */
+/* $NetBSD: jiffies.h,v 1.6 2014/07/26 14:24:08 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -56,19 +56,12 @@
static inline unsigned int
usecs_to_jiffies(unsigned int usec)
{
- if (hz <= 100)
- return mstohz(roundup(usec, (1000 / hz)));
+ const struct timeval tv = {
+ .tv_sec = usec / 1000000,
+ .tv_usec = usec % 1000000,
+ };
- /*
- * Avoid integer overflow on 32-bit platforms. The cutoff is
- * kinda arbitrary; for hz <= 2000, 0x200000 is safe, but both
- * values could wiggle around a little.
- */
- KASSERT(hz <= 2000);
- if (usec <= 0x200000)
- return ((usec * hz) / 1000000);
- else
- return ((usec / 1000000) * hz);
+ return tvtohz(&tv);
}
static inline unsigned int
Home |
Main Index |
Thread Index |
Old Index