From: jsg Date: Fri, 10 Apr 2015 05:52:09 +0000 (+0000) Subject: Make drm_can_sleep() match linux. No change in behaviour as it's X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d1c316d80c20b4b07d4b54f877230c80f0b92b5b;p=openbsd 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. --- 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); \