mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-27 03:49:57 -04:00
drm/vmwgfx: Replace ttm_bo_unref with ttm_bo_put
The function ttm_bo_put releases a reference to a TTM buffer object. The function's name is more aligned to the Linux kernel convention of naming ref-counting function _get and _put. A call to ttm_bo_unref takes the address of the TTM BO object's pointer and clears the pointer's value to NULL. This is not necessary in most cases and sometimes even worked around by the calling code. A call to ttm_bo_put only releases the reference without clearing the pointer. In places where is might be necessary, the current behaviour of cleaning the pointer is kept. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
2d18cb98d6
commit
6034d9d48e
@@ -300,7 +300,8 @@ out_no_setup:
|
||||
&batch->otables[i]);
|
||||
}
|
||||
|
||||
ttm_bo_unref(&batch->otable_bo);
|
||||
ttm_bo_put(batch->otable_bo);
|
||||
batch->otable_bo = NULL;
|
||||
out_no_bo:
|
||||
return ret;
|
||||
}
|
||||
@@ -365,7 +366,8 @@ static void vmw_otable_batch_takedown(struct vmw_private *dev_priv,
|
||||
vmw_bo_fence_single(bo, NULL);
|
||||
ttm_bo_unreserve(bo);
|
||||
|
||||
ttm_bo_unref(&batch->otable_bo);
|
||||
ttm_bo_put(batch->otable_bo);
|
||||
batch->otable_bo = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -463,7 +465,8 @@ static int vmw_mob_pt_populate(struct vmw_private *dev_priv,
|
||||
|
||||
out_unreserve:
|
||||
ttm_bo_unreserve(mob->pt_bo);
|
||||
ttm_bo_unref(&mob->pt_bo);
|
||||
ttm_bo_put(mob->pt_bo);
|
||||
mob->pt_bo = NULL;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -580,8 +583,10 @@ static void vmw_mob_pt_setup(struct vmw_mob *mob,
|
||||
*/
|
||||
void vmw_mob_destroy(struct vmw_mob *mob)
|
||||
{
|
||||
if (mob->pt_bo)
|
||||
ttm_bo_unref(&mob->pt_bo);
|
||||
if (mob->pt_bo) {
|
||||
ttm_bo_put(mob->pt_bo);
|
||||
mob->pt_bo = NULL;
|
||||
}
|
||||
kfree(mob);
|
||||
}
|
||||
|
||||
@@ -698,8 +703,10 @@ int vmw_mob_bind(struct vmw_private *dev_priv,
|
||||
|
||||
out_no_cmd_space:
|
||||
vmw_fifo_resource_dec(dev_priv);
|
||||
if (pt_set_up)
|
||||
ttm_bo_unref(&mob->pt_bo);
|
||||
if (pt_set_up) {
|
||||
ttm_bo_put(mob->pt_bo);
|
||||
mob->pt_bo = NULL;
|
||||
}
|
||||
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user