Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tegra: Use drm_gem_object_unreference_unlocked()

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>

authored by

Daniel Vetter and committed by
Thierry Reding
a07cdfe5 d849c82f

+2 -10
+1 -3
drivers/gpu/drm/tegra/drm.c
··· 277 277 if (!gem) 278 278 return NULL; 279 279 280 - mutex_lock(&drm->struct_mutex); 281 - drm_gem_object_unreference(gem); 282 - mutex_unlock(&drm->struct_mutex); 280 + drm_gem_object_unreference_unlocked(gem); 283 281 284 282 bo = to_tegra_bo(gem); 285 283 return &bo->base;
+1 -7
drivers/gpu/drm/tegra/gem.c
··· 28 28 static void tegra_bo_put(struct host1x_bo *bo) 29 29 { 30 30 struct tegra_bo *obj = host1x_to_tegra_bo(bo); 31 - struct drm_device *drm = obj->gem.dev; 32 31 33 - mutex_lock(&drm->struct_mutex); 34 - drm_gem_object_unreference(&obj->gem); 35 - mutex_unlock(&drm->struct_mutex); 32 + drm_gem_object_unreference_unlocked(&obj->gem); 36 33 } 37 34 38 35 static dma_addr_t tegra_bo_pin(struct host1x_bo *bo, struct sg_table **sgt) ··· 69 72 static struct host1x_bo *tegra_bo_get(struct host1x_bo *bo) 70 73 { 71 74 struct tegra_bo *obj = host1x_to_tegra_bo(bo); 72 - struct drm_device *drm = obj->gem.dev; 73 75 74 - mutex_lock(&drm->struct_mutex); 75 76 drm_gem_object_reference(&obj->gem); 76 - mutex_unlock(&drm->struct_mutex); 77 77 78 78 return bo; 79 79 }