drm/ttm: cleanup ttm_tt_(unbind|destroy)
ttm_tt_destroy should be the only one unbinding the object. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
14b3307429
commit
089f16c55b
|
@ -397,7 +397,6 @@ moved:
|
||||||
out_err:
|
out_err:
|
||||||
new_man = &bdev->man[bo->mem.mem_type];
|
new_man = &bdev->man[bo->mem.mem_type];
|
||||||
if ((new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm) {
|
if ((new_man->flags & TTM_MEMTYPE_FLAG_FIXED) && bo->ttm) {
|
||||||
ttm_tt_unbind(bo->ttm);
|
|
||||||
ttm_tt_destroy(bo->ttm);
|
ttm_tt_destroy(bo->ttm);
|
||||||
bo->ttm = NULL;
|
bo->ttm = NULL;
|
||||||
}
|
}
|
||||||
|
@ -419,7 +418,6 @@ static void ttm_bo_cleanup_memtype_use(struct ttm_buffer_object *bo)
|
||||||
bo->bdev->driver->move_notify(bo, NULL);
|
bo->bdev->driver->move_notify(bo, NULL);
|
||||||
|
|
||||||
if (bo->ttm) {
|
if (bo->ttm) {
|
||||||
ttm_tt_unbind(bo->ttm);
|
|
||||||
ttm_tt_destroy(bo->ttm);
|
ttm_tt_destroy(bo->ttm);
|
||||||
bo->ttm = NULL;
|
bo->ttm = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,6 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (old_mem->mem_type != TTM_PL_SYSTEM) {
|
if (old_mem->mem_type != TTM_PL_SYSTEM) {
|
||||||
ttm_tt_unbind(ttm);
|
|
||||||
ttm_bo_free_old_node(bo);
|
ttm_bo_free_old_node(bo);
|
||||||
ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
|
ttm_flag_masked(&old_mem->placement, TTM_PL_FLAG_SYSTEM,
|
||||||
TTM_PL_MASK_MEM);
|
TTM_PL_MASK_MEM);
|
||||||
|
@ -402,7 +401,6 @@ out2:
|
||||||
new_mem->mm_node = NULL;
|
new_mem->mm_node = NULL;
|
||||||
|
|
||||||
if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {
|
if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) && (ttm != NULL)) {
|
||||||
ttm_tt_unbind(ttm);
|
|
||||||
ttm_tt_destroy(ttm);
|
ttm_tt_destroy(ttm);
|
||||||
bo->ttm = NULL;
|
bo->ttm = NULL;
|
||||||
}
|
}
|
||||||
|
@ -651,7 +649,6 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
|
||||||
|
|
||||||
if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
|
if ((man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
|
||||||
(bo->ttm != NULL)) {
|
(bo->ttm != NULL)) {
|
||||||
ttm_tt_unbind(bo->ttm);
|
|
||||||
ttm_tt_destroy(bo->ttm);
|
ttm_tt_destroy(bo->ttm);
|
||||||
bo->ttm = NULL;
|
bo->ttm = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -166,11 +166,15 @@ EXPORT_SYMBOL(ttm_tt_set_placement_caching);
|
||||||
|
|
||||||
void ttm_tt_destroy(struct ttm_tt *ttm)
|
void ttm_tt_destroy(struct ttm_tt *ttm)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (unlikely(ttm == NULL))
|
if (unlikely(ttm == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ttm->state == tt_bound) {
|
if (ttm->state == tt_bound) {
|
||||||
ttm_tt_unbind(ttm);
|
ret = ttm->func->unbind(ttm);
|
||||||
|
BUG_ON(ret);
|
||||||
|
ttm->state = tt_unbound;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ttm->state == tt_unbound)
|
if (ttm->state == tt_unbound)
|
||||||
|
@ -251,17 +255,6 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ttm_dma_tt_fini);
|
EXPORT_SYMBOL(ttm_dma_tt_fini);
|
||||||
|
|
||||||
void ttm_tt_unbind(struct ttm_tt *ttm)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (ttm->state == tt_bound) {
|
|
||||||
ret = ttm->func->unbind(ttm);
|
|
||||||
BUG_ON(ret);
|
|
||||||
ttm->state = tt_unbound;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
|
int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
|
@ -622,15 +622,6 @@ extern int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
|
||||||
*/
|
*/
|
||||||
extern void ttm_tt_destroy(struct ttm_tt *ttm);
|
extern void ttm_tt_destroy(struct ttm_tt *ttm);
|
||||||
|
|
||||||
/**
|
|
||||||
* ttm_ttm_unbind:
|
|
||||||
*
|
|
||||||
* @ttm: The struct ttm_tt.
|
|
||||||
*
|
|
||||||
* Unbind a struct ttm_tt.
|
|
||||||
*/
|
|
||||||
extern void ttm_tt_unbind(struct ttm_tt *ttm);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ttm_tt_swapin:
|
* ttm_tt_swapin:
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue