drm/tegra: Use drm_gem_object_unreference_unlocked()
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 23 Nov 2015 09:32:48 +0000 (10:32 +0100)
committerThierry Reding <treding@nvidia.com>
Mon, 14 Dec 2015 09:50:37 +0000 (10:50 +0100)
This only grabs the mutex when really needed, but still has a might-
acquire lockdep check to make sure that's always possible. With this
patch Tegra DRM is officially struct_mutex free, yay!

v2: refernce_unlocked doesn't exist as kbuild spotted.

Cc: Thierry Reding <thierry.reding@gmail.com>
Acked-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
[treding@nvidia.com: remove unused variables]
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/drm.c
drivers/gpu/drm/tegra/gem.c

index b26f62e7334d4c8c3643d67f2e7f0b9b491e46cb..c4910d5284115e941f995ac25f0050117fc128e7 100644 (file)
@@ -277,9 +277,7 @@ host1x_bo_lookup(struct drm_device *drm, struct drm_file *file, u32 handle)
        if (!gem)
                return NULL;
 
-       mutex_lock(&drm->struct_mutex);
-       drm_gem_object_unreference(gem);
-       mutex_unlock(&drm->struct_mutex);
+       drm_gem_object_unreference_unlocked(gem);
 
        bo = to_tegra_bo(gem);
        return &bo->base;
index fb712316c522aa5441d163387eece89690681744..33add93b4ed96826a3f7da9bfc5d11d0018eff8b 100644 (file)
@@ -28,11 +28,8 @@ static inline struct tegra_bo *host1x_to_tegra_bo(struct host1x_bo *bo)
 static void tegra_bo_put(struct host1x_bo *bo)
 {
        struct tegra_bo *obj = host1x_to_tegra_bo(bo);
-       struct drm_device *drm = obj->gem.dev;
 
-       mutex_lock(&drm->struct_mutex);
-       drm_gem_object_unreference(&obj->gem);
-       mutex_unlock(&drm->struct_mutex);
+       drm_gem_object_unreference_unlocked(&obj->gem);
 }
 
 static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt)
@@ -72,11 +69,8 @@ static void tegra_bo_kunmap(struct host1x_bo *bo, unsigned int page,
 static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo)
 {
        struct tegra_bo *obj = host1x_to_tegra_bo(bo);
-       struct drm_device *drm = obj->gem.dev;
 
-       mutex_lock(&drm->struct_mutex);
        drm_gem_object_reference(&obj->gem);
-       mutex_unlock(&drm->struct_mutex);
 
        return bo;
 }