summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2017-07-22 14:33:46 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2017-07-22 14:33:46 +0000
commitdcde299afc055b737334395365b7ef6b2a485eb7 (patch)
tree14f18c8ef30d7032e82c095caaaa6ccf71b0f03c /sys/dev
parentd7aa318ee7fc97a01654cfc1ae74f45c36db4b51 (diff)
Introduce jiffies, a volatile unsigned long version of our ticks variable
for use by the linux compatibility APIs in drm(4). While I hate infecting code in sys/kern with this, untangling all the of having different types and different signedness is too much for me right now. The best strategy may be to change ticks itself to be long but that needs some careful auditing. ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drmP.h4
-rw-r--r--sys/dev/pci/drm/drm_linux.h15
2 files changed, 8 insertions, 11 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index 9cb8b7e0fcd..f04240a6737 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drmP.h,v 1.214 2017/07/19 22:05:58 kettenis Exp $ */
+/* $OpenBSD: drmP.h,v 1.215 2017/07/22 14:33:45 kettenis Exp $ */
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*/
@@ -122,8 +122,6 @@ struct fb_image;
#define DRM_WAKEUP(x) wakeup(x)
-extern int ticks;
-
#define drm_msleep(x) mdelay(x)
extern struct cfdriver drm_cd;
diff --git a/sys/dev/pci/drm/drm_linux.h b/sys/dev/pci/drm/drm_linux.h
index e6137080bb4..be718addcc3 100644
--- a/sys/dev/pci/drm/drm_linux.h
+++ b/sys/dev/pci/drm/drm_linux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.h,v 1.57 2017/07/17 17:57:27 kettenis Exp $ */
+/* $OpenBSD: drm_linux.h,v 1.58 2017/07/22 14:33:45 kettenis Exp $ */
/*
* Copyright (c) 2013, 2014, 2015 Mark Kettenis
*
@@ -839,8 +839,7 @@ timespec_sub(struct timespec t1, struct timespec t2)
#define time_in_range(x, min, max) ((x) >= (min) && (x) <= (max))
-extern int ticks;
-#define jiffies ticks
+extern volatile unsigned long jiffies;
#undef HZ
#define HZ hz
@@ -858,10 +857,10 @@ round_jiffies_up_relative(unsigned long j)
return roundup(j, hz);
}
-#define jiffies_to_msecs(x) (((int64_t)(x)) * 1000 / hz)
-#define jiffies_to_usecs(x) (((int64_t)(x)) * 1000000 / hz)
-#define msecs_to_jiffies(x) (((int64_t)(x)) * hz / 1000)
-#define nsecs_to_jiffies64(x) (((int64_t)(x)) * hz / 1000000000)
+#define jiffies_to_msecs(x) (((uint64_t)(x)) * 1000 / hz)
+#define jiffies_to_usecs(x) (((uint64_t)(x)) * 1000000 / hz)
+#define msecs_to_jiffies(x) (((uint64_t)(x)) * hz / 1000)
+#define nsecs_to_jiffies64(x) (((uint64_t)(x)) * hz / 1000000000)
#define get_jiffies_64() jiffies
#define time_after(a,b) ((long)(b) - (long)(a) < 0)
#define time_after_eq(a,b) ((long)(b) - (long)(a) <= 0)
@@ -886,7 +885,7 @@ timespec_to_ns(const struct timespec *ts)
return ((ts->tv_sec * NSEC_PER_SEC) + ts->tv_nsec);
}
-static inline int
+static inline unsigned long
timespec_to_jiffies(const struct timespec *ts)
{
long long to_ticks;