[34/59] drm/ttm: remove range manager legacy takedown path
diff mbox series

Message ID 20200804025632.3868079-35-airlied@gmail.com
State New
Headers show
Series
  • ttm misc cleanups, mem refactoring, rename objects. (v2)
Related show

Commit Message

Dave Airlie Aug. 4, 2020, 2:56 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

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

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(-)

Comments

Ben Skeggs Aug. 5, 2020, 5:45 a.m. UTC | #1
On Tue, 4 Aug 2020 at 12:58, Dave Airlie <airlied@gmail.com> wrote:
>
> From: Dave Airlie <airlied@redhat.com>
>
> Now all drivers have been converted, drop the non-driver path.
>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ben Skeggs <bskeggs@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 96da22be672b..86bf5e71e959 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_range_man_init(struct ttm_bo_device *bdev,
>  }
>  EXPORT_SYMBOL(ttm_range_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_range_man_fini(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_mem_type_manager_disable(man);
> @@ -157,7 +142,13 @@ int ttm_range_man_fini(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_mem_type_manager_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
> --
> 2.26.2
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index 96da22be672b..86bf5e71e959 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_range_man_init(struct ttm_bo_device *bdev,
 }
 EXPORT_SYMBOL(ttm_range_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_range_man_fini(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_mem_type_manager_disable(man);
@@ -157,7 +142,13 @@  int ttm_range_man_fini(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_mem_type_manager_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