Skip to contentSkip to conversation

drm/amdgpu: remove "num_pages" local variable in amdgpu_gtt_mgr_new

PATCH New brolerliew 1 participant 1 message Apr 8, 2024

Subsystems (2)
lore
Share & tools
lore

brolerliew

author
#0 lore raw

PATCH 1/1 drm/amdgpu: remove "num_pages" local variable in amdgpu_gtt_mgr_new

From: brolerliew <[email protected]>

amdgpu_gtt_mgr_new and ttm_range_man_alloc share similar logic, but "num_pages" in amdgpu_gtt_mgr_new is defined as local variable which is calculate directly in ttm_range_man_alloc.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c +1 -2
index 44367f03316f..0c56e4057d85 100644
@@ -116,7 +116,6 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man,
 			      struct ttm_resource **res)
 {
 	struct amdgpu_gtt_mgr *mgr = to_gtt_mgr(man);
-	uint32_t num_pages = PFN_UP(tbo->base.size);
 	struct ttm_range_mgr_node *node;
 	int r;
 
@@ -134,7 +133,7 @@ static int amdgpu_gtt_mgr_new(struct ttm_resource_manager *man,
 	if (place->lpfn) {
 		spin_lock(&mgr->lock);
 		r = drm_mm_insert_node_in_range(&mgr->mm, &node->mm_nodes[0],
-						num_pages, tbo->page_alignment,
+						PFN_UP(node->base.size), tbo->page_alignment,
 						0, place->fpfn, place->lpfn,
 						DRM_MM_INSERT_BEST);
 		spin_unlock(&mgr->lock);
Signature · 1 line
2.40.1