drm/cma-helper: Don't grab dev->struct_mutex for in mmap offset ioctl
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 9 Jul 2015 21:32:41 +0000 (23:32 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 10 Aug 2015 11:37:36 +0000 (13:37 +0200)
Since David Herrmann's mmap vma manager rework we don't need to grab
dev->struct_mutex any more to prevent races when looking up the mmap
offset. Drop it and instead don't forget to use the unref_unlocked
variant (since the drm core still cares).

Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Rob Clark <robdclark@gmail.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
drivers/gpu/drm/drm_gem_cma_helper.c

index 9edad11dca9852f551138b180b4eddbdc32038f2..86cc793cdf79d154b2caad7eb42a99e595812954 100644 (file)
@@ -289,20 +289,15 @@ int drm_gem_cma_dumb_map_offset(struct drm_file *file_priv,
 {
        struct drm_gem_object *gem_obj;
 
-       mutex_lock(&drm->struct_mutex);
-
        gem_obj = drm_gem_object_lookup(drm, file_priv, handle);
        if (!gem_obj) {
                dev_err(drm->dev, "failed to lookup GEM object\n");
-               mutex_unlock(&drm->struct_mutex);
                return -EINVAL;
        }
 
        *offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
 
-       drm_gem_object_unreference(gem_obj);
-
-       mutex_unlock(&drm->struct_mutex);
+       drm_gem_object_unreference_unlocked(gem_obj);
 
        return 0;
 }