Browse Source

video: driver: misc changes to be inline with upstream

- replace list_del() & list_add_tail() with list_move_tail().
- use sg_dma_address() macro at all possible places.

Change-Id: Ie754b5a75a48299fbe71e9ec0217b93d8524264f
Signed-off-by: Govindaraj Rajagopal <[email protected]>
Govindaraj Rajagopal 2 years ago
parent
commit
1931acf675

+ 2 - 4
driver/vidc/src/msm_vidc_driver.c

@@ -4277,8 +4277,7 @@ int msm_vidc_remove_session(struct msm_vidc_inst *inst)
 	core_lock(core, __func__);
 	core_lock(core, __func__);
 	list_for_each_entry_safe(i, temp, &core->instances, list) {
 	list_for_each_entry_safe(i, temp, &core->instances, list) {
 		if (i->session_id == inst->session_id) {
 		if (i->session_id == inst->session_id) {
-			list_del_init(&i->list);
-			list_add_tail(&i->list, &core->dangling_instances);
+			list_move_tail(&i->list, &core->dangling_instances);
 			i_vpr_h(inst, "%s: removed session %#x\n",
 			i_vpr_h(inst, "%s: removed session %#x\n",
 				__func__, i->session_id);
 				__func__, i->session_id);
 		}
 		}
@@ -4844,8 +4843,7 @@ int msm_vidc_core_deinit_locked(struct msm_vidc_core *core, bool force)
 	/* unlink all sessions from core, if any */
 	/* unlink all sessions from core, if any */
 	list_for_each_entry_safe(inst, dummy, &core->instances, list) {
 	list_for_each_entry_safe(inst, dummy, &core->instances, list) {
 		msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__);
 		msm_vidc_change_state(inst, MSM_VIDC_ERROR, __func__);
-		list_del_init(&inst->list);
-		list_add_tail(&inst->list, &core->dangling_instances);
+		list_move_tail(&inst->list, &core->dangling_instances);
 	}
 	}
 	msm_vidc_change_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);
 	msm_vidc_change_core_state(core, MSM_VIDC_CORE_DEINIT, __func__);
 
 

+ 6 - 10
driver/vidc/src/msm_vidc_memory.c

@@ -82,14 +82,13 @@ void *msm_vidc_pool_alloc(struct msm_vidc_inst *inst, enum msm_memory_pool_type
 		/* get 1st node from free pool */
 		/* get 1st node from free pool */
 		hdr = list_first_entry(&pool->free_pool,
 		hdr = list_first_entry(&pool->free_pool,
 			struct msm_memory_alloc_header, list);
 			struct msm_memory_alloc_header, list);
-		list_del_init(&hdr->list);
+
+		/* move node from free pool to busy pool */
+		list_move_tail(&hdr->list, &pool->busy_pool);
 
 
 		/* reset existing data */
 		/* reset existing data */
 		memset((char *)hdr->buf, 0, pool->size);
 		memset((char *)hdr->buf, 0, pool->size);
 
 
-		/* add to busy pool */
-		list_add_tail(&hdr->list, &pool->busy_pool);
-
 		/* set busy flag to true. This is to catch double free request */
 		/* set busy flag to true. This is to catch double free request */
 		hdr->busy = true;
 		hdr->busy = true;
 
 
@@ -141,11 +140,8 @@ void msm_vidc_pool_free(struct msm_vidc_inst *inst, void *vidc_buf)
 	}
 	}
 	hdr->busy = false;
 	hdr->busy = false;
 
 
-	/* remove from busy pool */
-	list_del_init(&hdr->list);
-
-	/* add to free pool */
-	list_add_tail(&hdr->list, &pool->free_pool);
+	/* move node from busy pool to free pool */
+	list_move_tail(&hdr->list, &pool->free_pool);
 }
 }
 
 
 static void msm_vidc_destroy_pool_buffers(struct msm_vidc_inst *inst,
 static void msm_vidc_destroy_pool_buffers(struct msm_vidc_inst *inst,
@@ -463,7 +459,7 @@ static int msm_vidc_memory_map(struct msm_vidc_core *core, struct msm_vidc_map *
 		goto error_table;
 		goto error_table;
 	}
 	}
 
 
-	map->device_addr = table->sgl->dma_address;
+	map->device_addr = sg_dma_address(table->sgl);
 	map->table = table;
 	map->table = table;
 	map->attach = attach;
 	map->attach = attach;
 	map->refcount++;
 	map->refcount++;

+ 1 - 1
driver/vidc/src/msm_vidc_memory_ext.c

@@ -279,7 +279,7 @@ static int msm_vidc_memory_map_ext(struct msm_vidc_core *core, struct msm_vidc_m
 		goto error_table;
 		goto error_table;
 	}
 	}
 
 
-	map->device_addr = table->sgl->dma_address;
+	map->device_addr = sg_dma_address(table->sgl);
 	map->table = table;
 	map->table = table;
 	map->attach = attach;
 	map->attach = attach;
 	map->refcount++;
 	map->refcount++;

+ 1 - 1
driver/vidc/src/msm_vidc_vb2.c

@@ -187,7 +187,7 @@ int msm_vb2_map_dmabuf(void *buf_priv)
 		rc = -ENOMEM;
 		rc = -ENOMEM;
 		goto exit;
 		goto exit;
 	}
 	}
-	buf->device_addr = buf->sg_table->sgl->dma_address;
+	buf->device_addr = sg_dma_address(buf->sg_table->sgl);
 	print_vidc_buffer(VIDC_HIGH, "high", "map", inst, buf);
 	print_vidc_buffer(VIDC_HIGH, "high", "map", inst, buf);
 
 
 exit:
 exit: