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 <quic_grajagop@quicinc.com>
This commit is contained in:
Govindaraj Rajagopal
2022-11-07 19:40:33 +05:30
parent 6b0dcb4a4f
commit 1931acf675
4 changed files with 10 additions and 16 deletions

View File

@@ -4277,8 +4277,7 @@ int msm_vidc_remove_session(struct msm_vidc_inst *inst)
core_lock(core, __func__);
list_for_each_entry_safe(i, temp, &core->instances, list) {
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",
__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 */
list_for_each_entry_safe(inst, dummy, &core->instances, list) {
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__);

View File

@@ -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 */
hdr = list_first_entry(&pool->free_pool,
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 */
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 */
hdr->busy = true;
@@ -141,11 +140,8 @@ void msm_vidc_pool_free(struct msm_vidc_inst *inst, void *vidc_buf)
}
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,
@@ -463,7 +459,7 @@ static int msm_vidc_memory_map(struct msm_vidc_core *core, struct msm_vidc_map *
goto error_table;
}
map->device_addr = table->sgl->dma_address;
map->device_addr = sg_dma_address(table->sgl);
map->table = table;
map->attach = attach;
map->refcount++;

View File

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

View File

@@ -187,7 +187,7 @@ int msm_vb2_map_dmabuf(void *buf_priv)
rc = -ENOMEM;
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);
exit: