diff mbox series

[24/49] drm/ttm: remove range manager legacy takedown path

Message ID 20200731040520.3701599-25-airlied@gmail.com (mailing list archive)
State New, archived
Headers show
Series ttm mem manager refactoring. | expand

Commit Message

Dave Airlie July 31, 2020, 4:04 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

Now no drivers have been converted, drop the non-driver path.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo_manager.c | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

Comments

Christian König July 31, 2020, 1:11 p.m. UTC | #1
Am 31.07.20 um 06:04 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> Now no drivers have been converted, drop the non-driver path.

I'm not a native speak, but that sounds odd.

Apart from that patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>

>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_manager.c | 28 +++++++++-------------------
>   1 file changed, 9 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> index 1127868274b3..f60a9a5d429d 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> @@ -129,26 +129,11 @@ int ttm_bo_man_init(struct ttm_bo_device *bdev,
>   }
>   EXPORT_SYMBOL(ttm_bo_man_init);
>   
> -static int ttm_bo_man_takedown_private(struct ttm_mem_type_manager *man)
> -{
> -	struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
> -	struct drm_mm *mm = &rman->mm;
> -
> -	spin_lock(&rman->lock);
> -	if (drm_mm_clean(mm)) {
> -		drm_mm_takedown(mm);
> -		spin_unlock(&rman->lock);
> -		kfree(rman);
> -		man->priv = NULL;
> -		return 0;
> -	}
> -	spin_unlock(&rman->lock);
> -	return -EBUSY;
> -}
> -
>   int ttm_bo_man_takedown(struct ttm_bo_device *bdev,
>   			struct ttm_mem_type_manager *man)
>   {
> +	struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
> +	struct drm_mm *mm = &rman->mm;
>   	int ret;
>   
>   	ttm_bo_disable_mm(man);
> @@ -157,7 +142,13 @@ int ttm_bo_man_takedown(struct ttm_bo_device *bdev,
>   	if (ret)
>   		return ret;
>   
> -	ttm_bo_man_takedown_private(man);
> +	spin_lock(&rman->lock);
> +	drm_mm_clean(mm);
> +	drm_mm_takedown(mm);
> +	spin_unlock(&rman->lock);
> +	kfree(rman);
> +	man->priv = NULL;
> +
>   	ttm_bo_man_cleanup(man);
>   	return 0;
>   }
> @@ -174,7 +165,6 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
>   }
>   
>   static const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
> -	.takedown = ttm_bo_man_takedown_private,
>   	.get_node = ttm_bo_man_get_node,
>   	.put_node = ttm_bo_man_put_node,
>   	.debug = ttm_bo_man_debug
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index 1127868274b3..f60a9a5d429d 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
@@ -129,26 +129,11 @@  int ttm_bo_man_init(struct ttm_bo_device *bdev,
 }
 EXPORT_SYMBOL(ttm_bo_man_init);
 
-static int ttm_bo_man_takedown_private(struct ttm_mem_type_manager *man)
-{
-	struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
-	struct drm_mm *mm = &rman->mm;
-
-	spin_lock(&rman->lock);
-	if (drm_mm_clean(mm)) {
-		drm_mm_takedown(mm);
-		spin_unlock(&rman->lock);
-		kfree(rman);
-		man->priv = NULL;
-		return 0;
-	}
-	spin_unlock(&rman->lock);
-	return -EBUSY;
-}
-
 int ttm_bo_man_takedown(struct ttm_bo_device *bdev,
 			struct ttm_mem_type_manager *man)
 {
+	struct ttm_range_manager *rman = (struct ttm_range_manager *) man->priv;
+	struct drm_mm *mm = &rman->mm;
 	int ret;
 
 	ttm_bo_disable_mm(man);
@@ -157,7 +142,13 @@  int ttm_bo_man_takedown(struct ttm_bo_device *bdev,
 	if (ret)
 		return ret;
 
-	ttm_bo_man_takedown_private(man);
+	spin_lock(&rman->lock);
+	drm_mm_clean(mm);
+	drm_mm_takedown(mm);
+	spin_unlock(&rman->lock);
+	kfree(rman);
+	man->priv = NULL;
+
 	ttm_bo_man_cleanup(man);
 	return 0;
 }
@@ -174,7 +165,6 @@  static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
 }
 
 static const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
-	.takedown = ttm_bo_man_takedown_private,
 	.get_node = ttm_bo_man_get_node,
 	.put_node = ttm_bo_man_put_node,
 	.debug = ttm_bo_man_debug