Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ttm: make ttm_tt unbind function return void.

The return value just led to BUG_ON, I think if a driver wants
to BUG_ON here it can do it itself. (don't BUG_ON).

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200728040003.20398-1-airlied@gmail.com

+13 -22
+2 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 1292 1292 * Called by ttm_tt_unbind() on behalf of ttm_bo_move_ttm() and 1293 1293 * ttm_tt_destroy(). 1294 1294 */ 1295 - static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm) 1295 + static void amdgpu_ttm_backend_unbind(struct ttm_tt *ttm) 1296 1296 { 1297 1297 struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev); 1298 1298 struct amdgpu_ttm_tt *gtt = (void *)ttm; ··· 1303 1303 amdgpu_ttm_tt_unpin_userptr(ttm); 1304 1304 1305 1305 if (gtt->offset == AMDGPU_BO_INVALID_OFFSET) 1306 - return 0; 1306 + return; 1307 1307 1308 1308 /* unbind shouldn't be done for GDS/GWS/OA in ttm_bo_clean_mm */ 1309 1309 r = amdgpu_gart_unbind(adev, gtt->offset, ttm->num_pages); 1310 1310 if (r) 1311 1311 DRM_ERROR("failed to unbind %lu pages at 0x%08llX\n", 1312 1312 gtt->ttm.ttm.num_pages, gtt->offset); 1313 - return r; 1314 1313 } 1315 1314 1316 1315 static void amdgpu_ttm_backend_destroy(struct ttm_tt *ttm)
+1 -2
drivers/gpu/drm/nouveau/nouveau_sgdma.c
··· 46 46 return 0; 47 47 } 48 48 49 - static int 49 + static void 50 50 nv04_sgdma_unbind(struct ttm_tt *ttm) 51 51 { 52 52 struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm; 53 53 nouveau_mem_fini(nvbe->mem); 54 - return 0; 55 54 } 56 55 57 56 static struct ttm_backend_func nv04_sgdma_backend = {
+1 -2
drivers/gpu/drm/qxl/qxl_ttm.c
··· 149 149 return -1; 150 150 } 151 151 152 - static int qxl_ttm_backend_unbind(struct ttm_tt *ttm) 152 + static void qxl_ttm_backend_unbind(struct ttm_tt *ttm) 153 153 { 154 154 /* Not implemented */ 155 - return -1; 156 155 } 157 156 158 157 static void qxl_ttm_backend_destroy(struct ttm_tt *ttm)
+1 -3
drivers/gpu/drm/radeon/radeon_ttm.c
··· 591 591 return 0; 592 592 } 593 593 594 - static int radeon_ttm_backend_unbind(struct ttm_tt *ttm) 594 + static void radeon_ttm_backend_unbind(struct ttm_tt *ttm) 595 595 { 596 596 struct radeon_ttm_tt *gtt = (void *)ttm; 597 597 ··· 599 599 600 600 if (gtt->userptr) 601 601 radeon_ttm_tt_unpin_userptr(ttm); 602 - 603 - return 0; 604 602 } 605 603 606 604 static void radeon_ttm_backend_destroy(struct ttm_tt *ttm)
+5 -4
drivers/gpu/drm/ttm/ttm_agp_backend.c
··· 82 82 return ret; 83 83 } 84 84 85 - static int ttm_agp_unbind(struct ttm_tt *ttm) 85 + static void ttm_agp_unbind(struct ttm_tt *ttm) 86 86 { 87 87 struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm); 88 88 89 89 if (agp_be->mem) { 90 - if (agp_be->mem->is_bound) 91 - return agp_unbind_memory(agp_be->mem); 90 + if (agp_be->mem->is_bound) { 91 + agp_unbind_memory(agp_be->mem); 92 + return; 93 + } 92 94 agp_free_memory(agp_be->mem); 93 95 agp_be->mem = NULL; 94 96 } 95 - return 0; 96 97 } 97 98 98 99 static void ttm_agp_destroy(struct ttm_tt *ttm)
+1 -4
drivers/gpu/drm/ttm/ttm_tt.c
··· 313 313 314 314 void ttm_tt_unbind(struct ttm_tt *ttm) 315 315 { 316 - int ret; 317 - 318 316 if (ttm->state == tt_bound) { 319 - ret = ttm->func->unbind(ttm); 320 - BUG_ON(ret); 317 + ttm->func->unbind(ttm); 321 318 ttm->state = tt_unbound; 322 319 } 323 320 }
+1 -3
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c
··· 610 610 return 0; 611 611 } 612 612 613 - static int vmw_ttm_unbind(struct ttm_tt *ttm) 613 + static void vmw_ttm_unbind(struct ttm_tt *ttm) 614 614 { 615 615 struct vmw_ttm_tt *vmw_be = 616 616 container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm); ··· 628 628 629 629 if (vmw_be->dev_priv->map_mode == vmw_dma_map_bind) 630 630 vmw_ttm_unmap_dma(vmw_be); 631 - 632 - return 0; 633 631 } 634 632 635 633
+1 -1
include/drm/ttm/ttm_tt.h
··· 70 70 * Unbind previously bound backend pages. This function should be 71 71 * able to handle differences between aperture and system page sizes. 72 72 */ 73 - int (*unbind) (struct ttm_tt *ttm); 73 + void (*unbind) (struct ttm_tt *ttm); 74 74 75 75 /** 76 76 * struct ttm_backend_func member destroy