[PATCH v2 09/38] drm: remove drm_driver::gem_free_object

Daniel Vetter daniel at ffwll.ch
Fri May 15 14:22:28 UTC 2020


On Fri, May 15, 2020 at 10:50:49AM +0100, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> No drivers set the callback, so remove it all together.
> 
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> Acked-by: Sam Ravnborg <sam at ravnborg.org>
> Reviewed-by: Thomas Zimmermann <tzimmermann at suse.de>

If I've read your series correctly I think you've missed one kerneldoc
line for @gem_free_object_unlocked:

	 * Compared to @gem_free_object this is not encumbered with
	 * &drm_device.struct_mutex legacy locking schemes.


With that also removed:

Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>

> ---
>  drivers/gpu/drm/drm_gem.c | 22 +++-------------------
>  include/drm/drm_drv.h     |  8 --------
>  include/drm/drm_gem.h     |  5 +++--
>  3 files changed, 6 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 12fa121d0966..dab8763b2e73 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -975,15 +975,10 @@ drm_gem_object_free(struct kref *kref)
>  		container_of(kref, struct drm_gem_object, refcount);
>  	struct drm_device *dev = obj->dev;
>  
> -	if (obj->funcs) {
> +	if (obj->funcs)
>  		obj->funcs->free(obj);
> -	} else if (dev->driver->gem_free_object_unlocked) {
> +	else if (dev->driver->gem_free_object_unlocked)
>  		dev->driver->gem_free_object_unlocked(obj);
> -	} else if (dev->driver->gem_free_object) {
> -		WARN_ON(!mutex_is_locked(&dev->struct_mutex));
> -
> -		dev->driver->gem_free_object(obj);
> -	}
>  }
>  EXPORT_SYMBOL(drm_gem_object_free);
>  
> @@ -999,21 +994,10 @@ EXPORT_SYMBOL(drm_gem_object_free);
>  void
>  drm_gem_object_put_unlocked(struct drm_gem_object *obj)
>  {
> -	struct drm_device *dev;
> -
>  	if (!obj)
>  		return;
>  
> -	dev = obj->dev;
> -
> -	if (dev->driver->gem_free_object) {
> -		might_lock(&dev->struct_mutex);
> -		if (kref_put_mutex(&obj->refcount, drm_gem_object_free,
> -				&dev->struct_mutex))
> -			mutex_unlock(&dev->struct_mutex);
> -	} else {
> -		kref_put(&obj->refcount, drm_gem_object_free);
> -	}
> +	kref_put(&obj->refcount, drm_gem_object_free);
>  }
>  EXPORT_SYMBOL(drm_gem_object_put_unlocked);
>  
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 6d457652f199..e6eff508f687 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -327,14 +327,6 @@ struct drm_driver {
>  	 */
>  	void (*debugfs_init)(struct drm_minor *minor);
>  
> -	/**
> -	 * @gem_free_object: deconstructor for drm_gem_objects
> -	 *
> -	 * This is deprecated and should not be used by new drivers. Use
> -	 * &drm_gem_object_funcs.free instead.
> -	 */
> -	void (*gem_free_object) (struct drm_gem_object *obj);
> -
>  	/**
>  	 * @gem_free_object_unlocked: deconstructor for drm_gem_objects
>  	 *
> diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> index 0b375069cd48..ec2d24a60a76 100644
> --- a/include/drm/drm_gem.h
> +++ b/include/drm/drm_gem.h
> @@ -272,8 +272,9 @@ struct drm_gem_object {
>  	 * attachment point for the device. This is invariant over the lifetime
>  	 * of a gem object.
>  	 *
> -	 * The &drm_driver.gem_free_object callback is responsible for cleaning
> -	 * up the dma_buf attachment and references acquired at import time.
> +	 * The &drm_driver.gem_free_object_unlocked callback is responsible for
> +	 * cleaning up the dma_buf attachment and references acquired at import
> +	 * time.
>  	 *
>  	 * Note that the drm gem/prime core does not depend upon drivers setting
>  	 * this field any more. So for drivers where this doesn't make sense
> -- 
> 2.25.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list