diff mbox

[27/50] drm/irq: Replace DRM_WAIT_ON with wait_event

Message ID 1386758111-3446-28-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Dec. 11, 2013, 10:34 a.m. UTC
Note that I've dropped the timeout - we don't expect the display
hardware to ever hang, and the current code isn't really up to handle
this correctly anyway.

The only risk I see is that old user modesetting drivers wreak havoc
with themselves by disabling the interrupt support at the wrong time.
But then again this means we're running X and will get a signal sooner
or later anyway. So it should get out of the loop latest when the user
attempts to do a vt switch.

Also extract the condition into a temporary macro for better
readability.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_irq.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index e7de2da57234..c0c6bdedefef 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -1244,12 +1244,14 @@  int drm_wait_vblank(struct drm_device *dev, void *data,
 	DRM_DEBUG("waiting on vblank count %d, crtc %d\n",
 		  vblwait->request.sequence, crtc);
 	dev->vblank[crtc].last_wait = vblwait->request.sequence;
-	DRM_WAIT_ON(ret, dev->vblank[crtc].queue, 3 * HZ,
-		    (((drm_vblank_count(dev, crtc) -
-		       vblwait->request.sequence) <= (1 << 23)) ||
-		     !dev->irq_enabled));
-
-	if (ret != -EINTR) {
+#define C \
+	(((drm_vblank_count(dev, crtc) - vblwait->request.sequence) \
+	  <= (1 << 23)) || \
+	 !dev->irq_enabled)
+	ret = wait_event_interruptible(dev->vblank[crtc].queue, C);
+#undef C
+
+	if (ret == 0) {
 		struct timeval now;
 
 		vblwait->reply.sequence = drm_vblank_count_and_time(dev, crtc, &now);