Re: [PATCH] drm/gem: consolidate handle deletion code.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 14, 2015 at 04:30:47PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@xxxxxxxxxx>
> 
> This code was duplicated, make it decidely
> less duplicated.
> 
> Signed-off-by: Dave Airlie <airlied@xxxxxxxxxx>

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

> ---
>  drivers/gpu/drm/drm_gem.c | 35 +++++++++++++++++------------------
>  1 file changed, 17 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 3c2d4ab..12d0dc7 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -239,6 +239,21 @@ drm_gem_object_handle_unreference_unlocked(struct drm_gem_object *obj)
>  	drm_gem_object_unreference_unlocked(obj);
>  }
>  
> +static void
> +drm_gem_handle_delete_tail(struct drm_file *filp,
> +			   struct drm_gem_object *obj)
> +{
> +	struct drm_device *dev = obj->dev;
> +
> +	if (drm_core_check_feature(dev, DRIVER_PRIME))
> +		drm_gem_remove_prime_handles(obj, filp);
> +	drm_vma_node_revoke(&obj->vma_node, filp->filp);
> +
> +	if (dev->driver->gem_close_object)
> +		dev->driver->gem_close_object(obj, filp);
> +	drm_gem_object_handle_unreference_unlocked(obj);
> +}
> +
>  /**
>   * drm_gem_handle_delete - deletes the given file-private handle
>   * @filp: drm file-private structure to use for the handle look up
> @@ -276,14 +291,7 @@ drm_gem_handle_delete(struct drm_file *filp, u32 handle)
>  	idr_remove(&filp->object_idr, handle);
>  	spin_unlock(&filp->table_lock);
>  
> -	if (drm_core_check_feature(dev, DRIVER_PRIME))
> -		drm_gem_remove_prime_handles(obj, filp);
> -	drm_vma_node_revoke(&obj->vma_node, filp->filp);
> -
> -	if (dev->driver->gem_close_object)
> -		dev->driver->gem_close_object(obj, filp);
> -	drm_gem_object_handle_unreference_unlocked(obj);
> -
> +	drm_gem_handle_delete_tail(filp, obj);
>  	return 0;
>  }
>  EXPORT_SYMBOL(drm_gem_handle_delete);
> @@ -708,17 +716,8 @@ drm_gem_object_release_handle(int id, void *ptr, void *data)
>  {
>  	struct drm_file *file_priv = data;
>  	struct drm_gem_object *obj = ptr;
> -	struct drm_device *dev = obj->dev;
> -
> -	if (drm_core_check_feature(dev, DRIVER_PRIME))
> -		drm_gem_remove_prime_handles(obj, file_priv);
> -	drm_vma_node_revoke(&obj->vma_node, file_priv->filp);
> -
> -	if (dev->driver->gem_close_object)
> -		dev->driver->gem_close_object(obj, file_priv);
> -
> -	drm_gem_object_handle_unreference_unlocked(obj);
>  
> +	drm_gem_handle_delete_tail(file_priv, obj);
>  	return 0;
>  }
>  
> -- 
> 2.5.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux