[openchrome-devel] [PATCH v1 6/6] drm/via: drop DRM_WAIT_ON() in via_video
Sam Ravnborg
sam at ravnborg.org
Thu Jul 18 15:37:37 UTC 2019
Replace DRM_WAIT_ON() with wait_event_interruptible().
Be careful to keep same return value semantics
Signed-off-by: Sam Ravnborg <sam at ravnborg.org>
Cc: Kevin Brace <kevinbrace at gmx.com>
Cc: Thomas Hellstrom <thellstrom at vmware.com>
Cc: "Gustavo A. R. Silva" <gustavo at embeddedor.com>
Cc: Mike Marshall <hubcap at omnibond.com>
Cc: Ira Weiny <ira.weiny at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Emil Velikov <emil.velikov at collabora.com>
---
drivers/gpu/drm/via/via_video.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
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;
--
2.20.1
More information about the openchrome-devel
mailing list