[v1,6/6] drm/via: drop DRM_WAIT_ON() in via_video

Submitted by Sam Ravnborg on July 18, 2019, 3:37 p.m.

Details

Message ID 20190718153737.28657-7-sam@ravnborg.org
State New
Headers show
Series "drm/via: drop use of deprecated headers drmP.h and drm_os_linux.h" ( rev: 1 ) in DRI devel

Not browsing as part of any series.

Commit Message

Sam Ravnborg July 18, 2019, 3:37 p.m.
Replace DRM_WAIT_ON() with wait_event_interruptible().
Be careful to keep same return value semantics

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Kevin Brace <kevinbrace@gmx.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: Mike Marshall <hubcap@omnibond.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Emil Velikov <emil.velikov@collabora.com>
---
 drivers/gpu/drm/via/via_video.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/via/via_video.c b/drivers/gpu/drm/via/via_video.c
index 4e165b1b0b18..1f88180affef 100644
--- a/drivers/gpu/drm/via/via_video.c
+++ b/drivers/gpu/drm/via/via_video.c
@@ -26,7 +26,6 @@ 
  */
 
 #include <drm/drm_device.h>
-#include <drm/drm_os_linux.h>
 #include <drm/via_drm.h>
 
 #include "via_drv.h"
@@ -73,7 +72,7 @@  int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_
 	volatile int *lock;
 	drm_via_private_t *dev_priv = (drm_via_private_t *) dev->dev_private;
 	drm_via_sarea_t *sAPriv = dev_priv->sarea_priv;
-	int ret = 0;
+	int ret;
 
 	DRM_DEBUG("\n");
 
@@ -84,9 +83,21 @@  int via_decoder_futex(struct drm_device *dev, void *data, struct drm_file *file_
 
 	switch (fx->func) {
 	case VIA_FUTEX_WAIT:
-		DRM_WAIT_ON(ret, dev_priv->decoder_queue[fx->lock],
-			    (fx->ms / 10) * (HZ / 100), *lock != fx->val);
-		return ret;
+		ret = wait_event_interruptible_timeout(
+				dev_priv->decoder_queue[fx->lock],
+				*lock != fx->val,
+				msecs_to_jiffies(fx->ms));
+		switch (ret) {
+		case 0:
+			/* timeout */
+			return -EBUSY;
+		case -ERESTARTSYS:
+			/* interrupted by signal */
+			return -EINTR;
+		default:
+			return 0;
+		}
+
 	case VIA_FUTEX_WAKE:
 		wake_up(&(dev_priv->decoder_queue[fx->lock]));
 		return 0;