mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
drm: remove _unlocked suffix in drm_gem_object_put_unlocked
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex. Just drop the suffix. It makes the API cleaner. Done via the following script: __from=drm_gem_object_put_unlocked __to=drm_gem_object_put for __file in $(git grep --name-only $__from); do sed -i "s/$__from/$__to/g" $__file; done Pay special attention to the compat #define v2: keep sed and #define removal separate Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Acked-by: Sam Ravnborg <sam@ravnborg.org> (v1) Reviewed-by: Steven Price <steven.price@arm.com> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20200515095118.2743122-14-emil.l.velikov@gmail.com
This commit is contained in:
parent
2f4dd13d4b
commit
be6ee10234
@ -178,7 +178,7 @@ GEM Objects Lifetime
|
||||
--------------------
|
||||
|
||||
All GEM objects are reference-counted by the GEM core. References can be
|
||||
acquired and release by calling drm_gem_object_get() and drm_gem_object_put_unlocked()
|
||||
acquired and release by calling drm_gem_object_get() and drm_gem_object_put()
|
||||
respectively.
|
||||
|
||||
When the last reference to a GEM object is released the GEM core calls
|
||||
|
@ -237,7 +237,7 @@ static void drm_client_buffer_delete(struct drm_client_buffer *buffer)
|
||||
drm_gem_vunmap(buffer->gem, buffer->vaddr);
|
||||
|
||||
if (buffer->gem)
|
||||
drm_gem_object_put_unlocked(buffer->gem);
|
||||
drm_gem_object_put(buffer->gem);
|
||||
|
||||
if (buffer->handle)
|
||||
drm_mode_destroy_dumb(dev, buffer->handle, buffer->client->file);
|
||||
|
@ -235,7 +235,7 @@ drm_gem_object_handle_put_unlocked(struct drm_gem_object *obj)
|
||||
mutex_unlock(&dev->object_name_lock);
|
||||
|
||||
if (final)
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -331,7 +331,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
|
||||
|
||||
*offset = drm_vma_node_offset_addr(&obj->vma_node);
|
||||
out:
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -690,7 +690,7 @@ static int objects_lookup(struct drm_file *filp, u32 *handle, int count,
|
||||
* Returns:
|
||||
*
|
||||
* @objs filled in with GEM object pointers. Returned GEM objects need to be
|
||||
* released with drm_gem_object_put_unlocked(). -ENOENT is returned on a lookup
|
||||
* released with drm_gem_object_put(). -ENOENT is returned on a lookup
|
||||
* failure. 0 is returned on success.
|
||||
*
|
||||
*/
|
||||
@ -785,7 +785,7 @@ long drm_gem_dma_resv_wait(struct drm_file *filep, u32 handle,
|
||||
else if (ret > 0)
|
||||
ret = 0;
|
||||
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -860,7 +860,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
|
||||
|
||||
err:
|
||||
mutex_unlock(&dev->object_name_lock);
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -898,7 +898,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
|
||||
|
||||
/* drm_gem_handle_create_tail unlocks dev->object_name_lock. */
|
||||
ret = drm_gem_handle_create_tail(file_priv, obj, &handle);
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -991,7 +991,7 @@ EXPORT_SYMBOL(drm_gem_object_free);
|
||||
* driver doesn't use &drm_device.struct_mutex for anything.
|
||||
*
|
||||
* For drivers not encumbered with legacy locking use
|
||||
* drm_gem_object_put_unlocked() instead.
|
||||
* drm_gem_object_put() instead.
|
||||
*/
|
||||
void
|
||||
drm_gem_object_put_locked(struct drm_gem_object *obj)
|
||||
@ -1030,7 +1030,7 @@ void drm_gem_vm_close(struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_gem_object *obj = vma->vm_private_data;
|
||||
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_vm_close);
|
||||
|
||||
@ -1079,7 +1079,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
|
||||
if (obj->funcs && obj->funcs->mmap) {
|
||||
ret = obj->funcs->mmap(obj, vma);
|
||||
if (ret) {
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
return ret;
|
||||
}
|
||||
WARN_ON(!(vma->vm_flags & VM_DONTEXPAND));
|
||||
@ -1089,7 +1089,7 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
|
||||
else if (dev->driver->gem_vm_ops)
|
||||
vma->vm_ops = dev->driver->gem_vm_ops;
|
||||
else {
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -1155,13 +1155,13 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_vma_node_is_allowed(node, priv)) {
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
if (node->readonly) {
|
||||
if (vma->vm_flags & VM_WRITE) {
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -1171,7 +1171,7 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
ret = drm_gem_mmap_obj(obj, drm_vma_node_size(node) << PAGE_SHIFT,
|
||||
vma);
|
||||
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
|
||||
return cma_obj;
|
||||
|
||||
error:
|
||||
drm_gem_object_put_unlocked(&cma_obj->base);
|
||||
drm_gem_object_put(&cma_obj->base);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(drm_gem_cma_create);
|
||||
@ -156,7 +156,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
|
||||
*/
|
||||
ret = drm_gem_handle_create(file_priv, gem_obj, handle);
|
||||
/* drop reference from allocate - handle holds it now. */
|
||||
drm_gem_object_put_unlocked(gem_obj);
|
||||
drm_gem_object_put(gem_obj);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
@ -380,13 +380,13 @@ unsigned long drm_gem_cma_get_unmapped_area(struct file *filp,
|
||||
return -EINVAL;
|
||||
|
||||
if (!drm_vma_node_is_allowed(node, priv)) {
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
return -EACCES;
|
||||
}
|
||||
|
||||
cma_obj = to_drm_gem_cma_obj(obj);
|
||||
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
|
||||
return cma_obj->vaddr ? (unsigned long)cma_obj->vaddr : -EINVAL;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ void drm_gem_fb_destroy(struct drm_framebuffer *fb)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
drm_gem_object_put_unlocked(fb->obj[i]);
|
||||
drm_gem_object_put(fb->obj[i]);
|
||||
|
||||
drm_framebuffer_cleanup(fb);
|
||||
kfree(fb);
|
||||
@ -175,7 +175,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
|
||||
+ mode_cmd->offsets[i];
|
||||
|
||||
if (objs[i]->size < min_size) {
|
||||
drm_gem_object_put_unlocked(objs[i]);
|
||||
drm_gem_object_put(objs[i]);
|
||||
ret = -EINVAL;
|
||||
goto err_gem_object_put;
|
||||
}
|
||||
@ -189,7 +189,7 @@ int drm_gem_fb_init_with_funcs(struct drm_device *dev,
|
||||
|
||||
err_gem_object_put:
|
||||
for (i--; i >= 0; i--)
|
||||
drm_gem_object_put_unlocked(objs[i]);
|
||||
drm_gem_object_put(objs[i]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_priv,
|
||||
*/
|
||||
ret = drm_gem_handle_create(file_priv, &shmem->base, handle);
|
||||
/* drop reference from allocate - handle holds it now. */
|
||||
drm_gem_object_put_unlocked(&shmem->base);
|
||||
drm_gem_object_put(&shmem->base);
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
|
||||
@ -684,7 +684,7 @@ drm_gem_shmem_prime_import_sg_table(struct drm_device *dev,
|
||||
err_free_array:
|
||||
kvfree(shmem->pages);
|
||||
err_free_gem:
|
||||
drm_gem_object_put_unlocked(&shmem->base);
|
||||
drm_gem_object_put(&shmem->base);
|
||||
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ int drm_gem_ttm_mmap(struct drm_gem_object *gem,
|
||||
* ttm has its own object refcounting, so drop gem reference
|
||||
* to avoid double accounting counting.
|
||||
*/
|
||||
drm_gem_object_put_unlocked(gem);
|
||||
drm_gem_object_put(gem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -618,9 +618,9 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
|
||||
|
||||
ret = drm_gem_handle_create(file, &gbo->bo.base, &handle);
|
||||
if (ret)
|
||||
goto err_drm_gem_object_put_unlocked;
|
||||
goto err_drm_gem_object_put;
|
||||
|
||||
drm_gem_object_put_unlocked(&gbo->bo.base);
|
||||
drm_gem_object_put(&gbo->bo.base);
|
||||
|
||||
args->pitch = pitch;
|
||||
args->size = size;
|
||||
@ -628,8 +628,8 @@ int drm_gem_vram_fill_create_dumb(struct drm_file *file,
|
||||
|
||||
return 0;
|
||||
|
||||
err_drm_gem_object_put_unlocked:
|
||||
drm_gem_object_put_unlocked(&gbo->bo.base);
|
||||
err_drm_gem_object_put:
|
||||
drm_gem_object_put(&gbo->bo.base);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_gem_vram_fill_create_dumb);
|
||||
@ -737,7 +737,7 @@ int drm_gem_vram_driver_dumb_mmap_offset(struct drm_file *file,
|
||||
gbo = drm_gem_vram_of_gem(gem);
|
||||
*offset = drm_gem_vram_mmap_offset(gbo);
|
||||
|
||||
drm_gem_object_put_unlocked(gem);
|
||||
drm_gem_object_put(gem);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ void drm_gem_dmabuf_release(struct dma_buf *dma_buf)
|
||||
struct drm_device *dev = obj->dev;
|
||||
|
||||
/* drop the reference on the export fd holds */
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
|
||||
drm_dev_put(dev);
|
||||
}
|
||||
@ -329,7 +329,7 @@ int drm_gem_prime_fd_to_handle(struct drm_device *dev,
|
||||
|
||||
/* _handle_create_tail unconditionally unlocks dev->object_name_lock. */
|
||||
ret = drm_gem_handle_create_tail(file_priv, obj, handle);
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
if (ret)
|
||||
goto out_put;
|
||||
|
||||
@ -500,7 +500,7 @@ out_have_handle:
|
||||
fail_put_dmabuf:
|
||||
dma_buf_put(dmabuf);
|
||||
out:
|
||||
drm_gem_object_put_unlocked(obj);
|
||||
drm_gem_object_put(obj);
|
||||
out_unlock:
|
||||
mutex_unlock(&file_priv->prime.lock);
|
||||
|
||||
|
@ -188,7 +188,7 @@ struct drm_gem_object {
|
||||
* Reference count of this object
|
||||
*
|
||||
* 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
|
||||
* or drm_gem_object_put() to release a reference to a GEM
|
||||
* buffer object.
|
||||
*/
|
||||
struct kref refcount;
|
||||
|
Loading…
Reference in New Issue
Block a user