diff options
author | Christian König <christian.koenig@amd.com> | 2022-02-18 10:05:40 +0100 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2022-05-09 14:49:50 +0200 |
commit | 3507932390bbfcf7c69dff9843f1c9da6ed4b861 (patch) | |
tree | d4fa2e34a9a6eb79d4066064d1baaeace4b043c7 /drivers/gpu/drm/vmwgfx | |
parent | drm/rockchip: Fix spelling mistake "aligened" -> "aligned" (diff) | |
download | linux-3507932390bbfcf7c69dff9843f1c9da6ed4b861.tar.xz linux-3507932390bbfcf7c69dff9843f1c9da6ed4b861.zip |
drm/ttm: move default BO destructor into VMWGFX v2
It's the only driver using this.
v2: use BUG_ON() in vmw_bo_create() as suggested by Zack
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220329110243.6335-5-christian.koenig@amd.com
Diffstat (limited to 'drivers/gpu/drm/vmwgfx')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c index eb94433067ba..85a66014c2b6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c @@ -393,6 +393,12 @@ void vmw_bo_bo_free(struct ttm_buffer_object *bo) kfree(vmw_bo); } +/* default destructor */ +static void vmw_bo_default_destroy(struct ttm_buffer_object *bo) +{ + kfree(bo); +} + /** * vmw_bo_create_kernel - Create a pinned BO for internal kernel use. * @@ -425,7 +431,7 @@ int vmw_bo_create_kernel(struct vmw_private *dev_priv, unsigned long size, ret = ttm_bo_init_reserved(&dev_priv->bdev, bo, size, ttm_bo_type_kernel, placement, 0, - &ctx, NULL, NULL, NULL); + &ctx, NULL, NULL, vmw_bo_default_destroy); if (unlikely(ret)) goto error_free; @@ -448,6 +454,8 @@ int vmw_bo_create(struct vmw_private *vmw, { int ret; + BUG_ON(!bo_free); + *p_bo = kmalloc(sizeof(**p_bo), GFP_KERNEL); if (unlikely(!*p_bo)) { DRM_ERROR("Failed to allocate a buffer.\n"); |