Use spldrm/splx around tsleep() in DRM_WAIT_ON
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 9 Sep 2003 07:45:12 +0000 (07:45 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Tue, 9 Sep 2003 07:45:12 +0000 (07:45 +0000)
bsd-core/drm_os_freebsd.h
bsd/drm_os_freebsd.h

index 2addf2f..a5049f5 100644 (file)
@@ -204,11 +204,13 @@ do {                                                              \
 
 #define DRM_HZ hz
 
-#define DRM_WAIT_ON( ret, queue, timeout, condition )                  \
-while (!condition) {                                                   \
-       ret = tsleep( &(queue), PZERO | PCATCH, "drmwtq", (timeout) );  \
-       if ( ret )                                                      \
-               return ret;                                             \
+#define DRM_WAIT_ON( ret, queue, timeout, condition )  \
+for ( ret = 0 ; !ret && !(condition) ; ) {             \
+        int s = spldrm();                              \
+       if (!(condition))                               \
+          ret = tsleep( &(queue), PZERO | PCATCH,      \
+                        "drmwtq", (timeout) );         \
+       splx(s);                                        \
 }
 
 #define DRM_WAKEUP( queue ) wakeup( queue )
index 2addf2f..a5049f5 100644 (file)
@@ -204,11 +204,13 @@ do {                                                              \
 
 #define DRM_HZ hz
 
-#define DRM_WAIT_ON( ret, queue, timeout, condition )                  \
-while (!condition) {                                                   \
-       ret = tsleep( &(queue), PZERO | PCATCH, "drmwtq", (timeout) );  \
-       if ( ret )                                                      \
-               return ret;                                             \
+#define DRM_WAIT_ON( ret, queue, timeout, condition )  \
+for ( ret = 0 ; !ret && !(condition) ; ) {             \
+        int s = spldrm();                              \
+       if (!(condition))                               \
+          ret = tsleep( &(queue), PZERO | PCATCH,      \
+                        "drmwtq", (timeout) );         \
+       splx(s);                                        \
 }
 
 #define DRM_WAKEUP( queue ) wakeup( queue )