Skip to contentSkip to conversation

drm/ttm: Dead code elimination & comment addition

PATCH In review Jerome Glisse 2 participants 2 messages Nov 5, 2009 – Nov 15, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: Dead code elimination & comment addition

Remove dead code in ttm_bo_handle_mem_move and add comment on what we are doing their and why.

---
 drivers/gpu/drm/ttm/ttm_bo.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +5 -9
index 87c0625..aea4699 100644
@@ -309,9 +309,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 		ttm_bo_unmap_virtual(bo);
 
 	/*
-	 * Create and bind a ttm if required.
+	 * Create and bind a ttm if new placement is not on card memory.
 	 */
-
 	if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && (bo->ttm == NULL)) {
 		ret = ttm_bo_add_ttm(bo, false);
 		if (ret)
@@ -327,15 +326,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
 				goto out_err;
 		}
 
+		/* New placement is not on card and old placement is system
+		 * memory we can thus simply copy new placement informations
+		 */
 		if (bo->mem.mem_type == TTM_PL_SYSTEM) {
-
-			struct ttm_mem_reg *old_mem = &bo->mem;
-			uint32_t save_flags = old_mem->placement;
-
-			*old_mem = *mem;
+			bo->mem = *mem;
 			mem->mm_node = NULL;
-			ttm_flag_masked(&save_flags, mem->placement,
-					TTM_PL_MASK_MEMTYPE);
 			goto moved;
 		}
 
Signature · 1 line
1.6.5.1
maintainer
#1 lore raw
Quoted 3 lines · Jerome Glisse

Remove dead code in ttm_bo_handle_mem_move and add comment on what we are doing their and why.

I haven't seen Thomas's ACK on this? I'd like to keep TTM under his control ;-)

Dave.

Quoted 44 lines

---
 drivers/gpu/drm/ttm/ttm_bo.c |   14 +++++---------

 1 files changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/ttm/ttm_bo.c +5 -10
index 87c0625..aea4699 100644
@@ -309,9 +309,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
                ttm_bo_unmap_virtual(bo);
 
        /*
-        * Create and bind a ttm if required.
+        * Create and bind a ttm if new placement is not on card memory.
         */
-
        if (!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && (bo->ttm == NULL)) {
                ret = ttm_bo_add_ttm(bo, false);
                if (ret)
@@ -327,15 +326,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
                                goto out_err;
                }
 
+               /* New placement is not on card and old placement is system
+                * memory we can thus simply copy new placement informations
+                */
                if (bo->mem.mem_type == TTM_PL_SYSTEM) {
-
-                       struct ttm_mem_reg *old_mem = &bo->mem;
-                       uint32_t save_flags = old_mem->placement;
-
-                       *old_mem = *mem;
+                       bo->mem = *mem;
                        mem->mm_node = NULL;
-                       ttm_flag_masked(&save_flags, mem->placement,
-                                       TTM_PL_MASK_MEMTYPE);
                        goto moved;
                }
 
--

1.6.5.1