diff mbox series

[13/49] drm/ttm: purge old manager init path.

Message ID 20200731040520.3701599-14-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>

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c         | 19 -------------------
 drivers/gpu/drm/ttm/ttm_bo_manager.c | 27 +++++++++------------------
 include/drm/ttm/ttm_bo_api.h         |  2 --
 include/drm/ttm/ttm_bo_driver.h      | 14 --------------
 4 files changed, 9 insertions(+), 53 deletions(-)

Comments

Christian König July 31, 2020, 12:58 p.m. UTC | #1
Am 31.07.20 um 06:04 schrieb Dave Airlie:
> From: Dave Airlie <airlied@redhat.com>
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_bo.c         | 19 -------------------
>   drivers/gpu/drm/ttm/ttm_bo_manager.c | 27 +++++++++------------------
>   include/drm/ttm/ttm_bo_api.h         |  2 --
>   include/drm/ttm/ttm_bo_driver.h      | 14 --------------
>   4 files changed, 9 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 476e768c5bd2..101a7910f9f7 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -1523,25 +1523,6 @@ void ttm_bo_init_mm_base(struct ttm_bo_device *bdev,
>   }
>   EXPORT_SYMBOL(ttm_bo_init_mm_base);
>   
> -int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
> -			unsigned long p_size)
> -{
> -	int ret;
> -	struct ttm_mem_type_manager *man;
> -
> -	BUG_ON(type >= TTM_NUM_MEM_TYPES);
> -	ttm_bo_init_mm_base(bdev, &bdev->man[type], p_size);
> -
> -	if (type != TTM_PL_SYSTEM) {
> -		ret = (*man->func->init)(man, p_size);
> -		if (ret)
> -			return ret;
> -	}
> -	ttm_bo_use_mm(man);
> -	return 0;
> -}
> -EXPORT_SYMBOL(ttm_bo_init_mm);
> -
>   static void ttm_bo_global_kobj_release(struct kobject *kobj)
>   {
>   	struct ttm_bo_global *glob =
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> index 64234e5caee3..1877425abdf0 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
> @@ -104,11 +104,18 @@ static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
>   	}
>   }
>   
> -static int ttm_bo_man_init_private(struct ttm_mem_type_manager *man,
> +static const struct ttm_mem_type_manager_func ttm_bo_manager_func;
> +
> +int ttm_bo_man_init(struct ttm_bo_device *bdev,
> +		    struct ttm_mem_type_manager *man,
>   		    unsigned long p_size)
>   {
>   	struct ttm_range_manager *rman;
>   
> +	man->func = &ttm_bo_manager_func;
> +
> +	ttm_bo_init_mm_base(bdev, man, p_size);
> +
>   	rman = kzalloc(sizeof(*rman), GFP_KERNEL);
>   	if (!rman)
>   		return -ENOMEM;
> @@ -116,21 +123,7 @@ static int ttm_bo_man_init_private(struct ttm_mem_type_manager *man,
>   	drm_mm_init(&rman->mm, 0, p_size);
>   	spin_lock_init(&rman->lock);
>   	man->priv = rman;
> -	return 0;
> -}
>   
> -int ttm_bo_man_init(struct ttm_bo_device *bdev,
> -		    struct ttm_mem_type_manager *man,
> -		    unsigned long p_size)
> -{
> -	int ret;
> -
> -	man->func = &ttm_bo_manager_func;
> -
> -	ttm_bo_init_mm_base(bdev, man, p_size);
> -	ret = ttm_bo_man_init_private(man, p_size);
> -	if (ret)
> -		return ret;
>   	ttm_bo_use_mm(man);
>   	return 0;
>   }
> @@ -163,11 +156,9 @@ static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
>   	spin_unlock(&rman->lock);
>   }
>   
> -const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
> -	.init = ttm_bo_man_init_private,
> +static const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
>   	.takedown = ttm_bo_man_takedown,
>   	.get_node = ttm_bo_man_get_node,
>   	.put_node = ttm_bo_man_put_node,
>   	.debug = ttm_bo_man_debug
>   };
> -EXPORT_SYMBOL(ttm_bo_manager_func);
> diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
> index 0060925f507a..6562d1c5ac59 100644
> --- a/include/drm/ttm/ttm_bo_api.h
> +++ b/include/drm/ttm/ttm_bo_api.h
> @@ -550,8 +550,6 @@ struct ttm_mem_type_manager;
>   void ttm_bo_init_mm_base(struct ttm_bo_device *bdev,
>   			 struct ttm_mem_type_manager *man,
>   			 unsigned long p_size);
> -int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
> -		   unsigned long p_size);
>   
>   /**
>    * ttm_bo_clean_mm
> diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
> index 5c4ccefd5393..d0f1a6cdfba7 100644
> --- a/include/drm/ttm/ttm_bo_driver.h
> +++ b/include/drm/ttm/ttm_bo_driver.h
> @@ -48,19 +48,6 @@
>   struct ttm_mem_type_manager;
>   
>   struct ttm_mem_type_manager_func {
> -	/**
> -	 * struct ttm_mem_type_manager member init
> -	 *
> -	 * @man: Pointer to a memory type manager.
> -	 * @p_size: Implementation dependent, but typically the size of the
> -	 * range to be managed in pages.
> -	 *
> -	 * Called to initialize a private range manager. The function is
> -	 * expected to initialize the man::priv member.
> -	 * Returns 0 on success, negative error code on failure.
> -	 */
> -	int  (*init)(struct ttm_mem_type_manager *man, unsigned long p_size);
> -
>   	/**
>   	 * struct ttm_mem_type_manager member takedown
>   	 *
> @@ -802,6 +789,5 @@ pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
>   int ttm_bo_man_init(struct ttm_bo_device *bdev,
>   		    struct ttm_mem_type_manager *man,
>   		    unsigned long p_size);
> -extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
>   
>   #endif
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 476e768c5bd2..101a7910f9f7 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -1523,25 +1523,6 @@  void ttm_bo_init_mm_base(struct ttm_bo_device *bdev,
 }
 EXPORT_SYMBOL(ttm_bo_init_mm_base);
 
-int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
-			unsigned long p_size)
-{
-	int ret;
-	struct ttm_mem_type_manager *man;
-
-	BUG_ON(type >= TTM_NUM_MEM_TYPES);
-	ttm_bo_init_mm_base(bdev, &bdev->man[type], p_size);
-
-	if (type != TTM_PL_SYSTEM) {
-		ret = (*man->func->init)(man, p_size);
-		if (ret)
-			return ret;
-	}
-	ttm_bo_use_mm(man);
-	return 0;
-}
-EXPORT_SYMBOL(ttm_bo_init_mm);
-
 static void ttm_bo_global_kobj_release(struct kobject *kobj)
 {
 	struct ttm_bo_global *glob =
diff --git a/drivers/gpu/drm/ttm/ttm_bo_manager.c b/drivers/gpu/drm/ttm/ttm_bo_manager.c
index 64234e5caee3..1877425abdf0 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_manager.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_manager.c
@@ -104,11 +104,18 @@  static void ttm_bo_man_put_node(struct ttm_mem_type_manager *man,
 	}
 }
 
-static int ttm_bo_man_init_private(struct ttm_mem_type_manager *man,
+static const struct ttm_mem_type_manager_func ttm_bo_manager_func;
+
+int ttm_bo_man_init(struct ttm_bo_device *bdev,
+		    struct ttm_mem_type_manager *man,
 		    unsigned long p_size)
 {
 	struct ttm_range_manager *rman;
 
+	man->func = &ttm_bo_manager_func;
+
+	ttm_bo_init_mm_base(bdev, man, p_size);
+
 	rman = kzalloc(sizeof(*rman), GFP_KERNEL);
 	if (!rman)
 		return -ENOMEM;
@@ -116,21 +123,7 @@  static int ttm_bo_man_init_private(struct ttm_mem_type_manager *man,
 	drm_mm_init(&rman->mm, 0, p_size);
 	spin_lock_init(&rman->lock);
 	man->priv = rman;
-	return 0;
-}
 
-int ttm_bo_man_init(struct ttm_bo_device *bdev,
-		    struct ttm_mem_type_manager *man,
-		    unsigned long p_size)
-{
-	int ret;
-
-	man->func = &ttm_bo_manager_func;
-
-	ttm_bo_init_mm_base(bdev, man, p_size);
-	ret = ttm_bo_man_init_private(man, p_size);
-	if (ret)
-		return ret;
 	ttm_bo_use_mm(man);
 	return 0;
 }
@@ -163,11 +156,9 @@  static void ttm_bo_man_debug(struct ttm_mem_type_manager *man,
 	spin_unlock(&rman->lock);
 }
 
-const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
-	.init = ttm_bo_man_init_private,
+static const struct ttm_mem_type_manager_func ttm_bo_manager_func = {
 	.takedown = ttm_bo_man_takedown,
 	.get_node = ttm_bo_man_get_node,
 	.put_node = ttm_bo_man_put_node,
 	.debug = ttm_bo_man_debug
 };
-EXPORT_SYMBOL(ttm_bo_manager_func);
diff --git a/include/drm/ttm/ttm_bo_api.h b/include/drm/ttm/ttm_bo_api.h
index 0060925f507a..6562d1c5ac59 100644
--- a/include/drm/ttm/ttm_bo_api.h
+++ b/include/drm/ttm/ttm_bo_api.h
@@ -550,8 +550,6 @@  struct ttm_mem_type_manager;
 void ttm_bo_init_mm_base(struct ttm_bo_device *bdev,
 			 struct ttm_mem_type_manager *man,
 			 unsigned long p_size);
-int ttm_bo_init_mm(struct ttm_bo_device *bdev, unsigned type,
-		   unsigned long p_size);
 
 /**
  * ttm_bo_clean_mm
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 5c4ccefd5393..d0f1a6cdfba7 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -48,19 +48,6 @@ 
 struct ttm_mem_type_manager;
 
 struct ttm_mem_type_manager_func {
-	/**
-	 * struct ttm_mem_type_manager member init
-	 *
-	 * @man: Pointer to a memory type manager.
-	 * @p_size: Implementation dependent, but typically the size of the
-	 * range to be managed in pages.
-	 *
-	 * Called to initialize a private range manager. The function is
-	 * expected to initialize the man::priv member.
-	 * Returns 0 on success, negative error code on failure.
-	 */
-	int  (*init)(struct ttm_mem_type_manager *man, unsigned long p_size);
-
 	/**
 	 * struct ttm_mem_type_manager member takedown
 	 *
@@ -802,6 +789,5 @@  pgprot_t ttm_io_prot(uint32_t caching_flags, pgprot_t tmp);
 int ttm_bo_man_init(struct ttm_bo_device *bdev,
 		    struct ttm_mem_type_manager *man,
 		    unsigned long p_size);
-extern const struct ttm_mem_type_manager_func ttm_bo_manager_func;
 
 #endif