Vast majority of DRM (core and drivers) are struct_mutex free.
As such we have only a handful of cases where the locked helper should
be used. Make that stand out a little bit better.
Done via the following script:
__from=drm_gem_object_put
__to=drm_gem_object_put_locked
for __file in $(git grep --name-only --word-regexp $__from); do
sed -i "s/\<$__from\>/$__to/g" $__file;
done
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20200515095118.2743122-12-emil.l.velikov@gmail.com
EXPORT_SYMBOL(drm_gem_object_free);
/**
- * drm_gem_object_put - release a GEM buffer object reference
+ * drm_gem_object_put_locked - release a GEM buffer object reference
* @obj: GEM buffer object
*
* This releases a reference to @obj. Callers must hold the
* drm_gem_object_put_unlocked() instead.
*/
void
-drm_gem_object_put(struct drm_gem_object *obj)
+drm_gem_object_put_locked(struct drm_gem_object *obj)
{
if (obj) {
WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));
kref_put(&obj->refcount, drm_gem_object_free);
}
}
-EXPORT_SYMBOL(drm_gem_object_put);
+EXPORT_SYMBOL(drm_gem_object_put_locked);
/**
* drm_gem_vm_open - vma->ops->open implementation for GEM
if (a5xx_gpu->pm4_bo) {
msm_gem_unpin_iova(a5xx_gpu->pm4_bo, gpu->aspace);
- drm_gem_object_put(a5xx_gpu->pm4_bo);
+ drm_gem_object_put_locked(a5xx_gpu->pm4_bo);
a5xx_gpu->pm4_bo = NULL;
}
if (a5xx_gpu->pfp_bo) {
msm_gem_unpin_iova(a5xx_gpu->pfp_bo, gpu->aspace);
- drm_gem_object_put(a5xx_gpu->pfp_bo);
+ drm_gem_object_put_locked(a5xx_gpu->pfp_bo);
a5xx_gpu->pfp_bo = NULL;
}
ret = 0;
}
- drm_gem_object_put(obj);
+ drm_gem_object_put_locked(obj);
unlock:
mutex_unlock(&dev->struct_mutex);
}
#endif
-/* don't call directly! Use drm_gem_object_put() and friends */
+/* don't call directly! Use drm_gem_object_put_locked() and friends */
void msm_gem_free_object(struct drm_gem_object *obj)
{
struct msm_gem_object *msm_obj = to_msm_bo(obj);
return vaddr;
err:
if (locked)
- drm_gem_object_put(obj);
+ drm_gem_object_put_locked(obj);
else
drm_gem_object_put_unlocked(obj);
msm_gem_unpin_iova(bo, aspace);
if (locked)
- drm_gem_object_put(bo);
+ drm_gem_object_put_locked(bo);
else
drm_gem_object_put_unlocked(bo);
}
struct msm_gem_object *msm_obj = submit->bos[i].obj;
submit_unlock_unpin_bo(submit, i, false);
list_del_init(&msm_obj->submit_entry);
- drm_gem_object_put(&msm_obj->base);
+ drm_gem_object_put_locked(&msm_obj->base);
}
}
/* move to inactive: */
msm_gem_move_to_inactive(&msm_obj->base);
msm_gem_unpin_iova(&msm_obj->base, submit->aspace);
- drm_gem_object_put(&msm_obj->base);
+ drm_gem_object_put_locked(&msm_obj->base);
}
pm_runtime_mark_last_busy(&gpu->pdev->dev);
*
* Reference count of this object
*
- * Please use drm_gem_object_get() to acquire and drm_gem_object_put()
+ * Please use drm_gem_object_get() to acquire and drm_gem_object_put_locked()
* or drm_gem_object_put_unlocked() to release a reference to a GEM
* buffer object.
*/
kref_put(&obj->refcount, drm_gem_object_free);
}
-void drm_gem_object_put(struct drm_gem_object *obj);
+void drm_gem_object_put_locked(struct drm_gem_object *obj);
int drm_gem_handle_create(struct drm_file *file_priv,
struct drm_gem_object *obj,