[PATCH 15/49] drm/ttm: make some inline helper functions for cleanup paths.

Christian König christian.koenig at amd.com
Fri Jul 31 13:07:04 UTC 2020


Am 31.07.20 um 06:04 schrieb Dave Airlie:
> From: Dave Airlie <airlied at redhat.com>
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c    |  6 ++----
>   include/drm/ttm/ttm_bo_driver.h | 12 ++++++++++++
>   2 files changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 84e399395e4f..f584e5e94383 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1462,8 +1462,7 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
>   		return ret;
>   	}
>   
> -	man->use_type = false;
> -	man->has_type = false;
> +	ttm_bo_disable_mm(man);
>   
>   	ret = 0;
>   	if (mem_type > 0) {
> @@ -1476,8 +1475,7 @@ int ttm_bo_clean_mm(struct ttm_bo_device *bdev, unsigned mem_type)
>   		ret = (*man->func->takedown)(man);
>   	}
>   
> -	dma_fence_put(man->move);
> -	man->move = NULL;
> +	ttm_bo_man_cleanup(man);
>   
>   	return ret;
>   }
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index d0f1a6cdfba7..92bb54cce633 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -671,6 +671,18 @@ static inline void ttm_bo_use_mm(struct ttm_mem_type_manager *man)
>   	man->use_type = true;
>   }
>   
> +static inline void ttm_bo_disable_mm(struct ttm_mem_type_manager *man)
> +{
> +	man->has_type = false;
> +	man->use_type = false;
> +}
> +
> +static inline void ttm_bo_man_cleanup(struct ttm_mem_type_manager *man)
> +{
> +	dma_fence_put(man->move);
> +	man->move = NULL;
> +}
> +

What's the value in making those inline? This is not performance 
critical at all.

Christian.

>   /*
>    * ttm_bo_util.c
>    */



More information about the dri-devel mailing list