drm/crtc: Convert setcrtc ioctl locking to interruptible.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 12 Sep 2017 13:37:49 +0000 (15:37 +0200)
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Wed, 13 Sep 2017 07:52:05 +0000 (09:52 +0200)
Pass DRM_MODESET_ACQUIRE_INTERRUPTIBLE to acquire_init, and handle
drm_modeset_backoff which can now fail by returning the error.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20170912133749.6532-7-maarten.lankhorst@linux.intel.com
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
drivers/gpu/drm/drm_crtc.c

index 5af25ce5bf7c2779a62aa5c74096d7ca3a73a588..68b4e976d5e0f37fca1ac42a2d2b469c64c73e4b 100644 (file)
@@ -577,7 +577,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
        DRM_DEBUG_KMS("[CRTC:%d:%s]\n", crtc->base.id, crtc->name);
 
        mutex_lock(&crtc->dev->mode_config.mutex);
-       drm_modeset_acquire_init(&ctx, 0);
+       drm_modeset_acquire_init(&ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE);
 retry:
        ret = drm_modeset_lock_all_ctx(crtc->dev, &ctx);
        if (ret)
@@ -717,8 +717,9 @@ out:
        kfree(connector_set);
        drm_mode_destroy(dev, mode);
        if (ret == -EDEADLK) {
-               drm_modeset_backoff(&ctx);
-               goto retry;
+               ret = drm_modeset_backoff(&ctx);
+               if (!ret)
+                       goto retry;
        }
        drm_modeset_drop_locks(&ctx);
        drm_modeset_acquire_fini(&ctx);