summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2015-04-10 05:52:09 +0000
committerjsg <jsg@openbsd.org>2015-04-10 05:52:09 +0000
commitd1c316d80c20b4b07d4b54f877230c80f0b92b5b (patch)
tree085cfc612a78910b10bddda086e296e10ab58f16 /sys/dev
parentadd irqs_disabled() and in_dbg_master() using cold and db_is_active (diff)
downloadwireguard-openbsd-d1c316d80c20b4b07d4b54f877230c80f0b92b5b.tar.xz
wireguard-openbsd-d1c316d80c20b4b07d4b54f877230c80f0b92b5b.zip
Make drm_can_sleep() match linux. No change in behaviour as it's
only ever used to decide between mdelay and drm_msleep and our drm_msleep delays instead of sleeping.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/drm/drmP.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h
index acf0dadf830..56eb25e4808 100644
--- a/sys/dev/pci/drm/drmP.h
+++ b/sys/dev/pci/drm/drmP.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: drmP.h,v 1.187 2015/04/10 05:31:25 jsg Exp $ */
+/* $OpenBSD: drmP.h,v 1.188 2015/04/10 05:52:09 jsg Exp $ */
/* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*-
* Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com
*/
@@ -155,7 +155,14 @@ extern struct cfdriver drm_cd;
#define DRM_COPY_FROM_USER(kern, user, size) copyin(user, kern, size)
#define DRM_UDELAY(udelay) DELAY(udelay)
-#define drm_can_sleep() (hz & 1)
+
+static inline bool
+drm_can_sleep(void)
+{
+ if (in_atomic() || in_dbg_master() || irqs_disabled())
+ return false;
+ return true;
+}
#define DRM_WAIT_ON(ret, queue, lock, timeout, msg, condition ) do { \
mtx_enter(lock); \