Skip to content

Commit 08bb88c

Browse files
committed
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 <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 92be423 commit 08bb88c

File tree

8 files changed

+13
-22
lines changed

8 files changed

+13
-22
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo)
12921292
* Called by ttm_tt_unbind() on behalf of ttm_bo_move_ttm() and
12931293
* ttm_tt_destroy().
12941294
*/
1295-
static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
1295+
static void amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
12961296
{
12971297
struct amdgpu_device *adev = amdgpu_ttm_adev(ttm->bdev);
12981298
struct amdgpu_ttm_tt *gtt = (void *)ttm;
@@ -1303,14 +1303,13 @@ static int amdgpu_ttm_backend_unbind(struct ttm_tt *ttm)
13031303
amdgpu_ttm_tt_unpin_userptr(ttm);
13041304

13051305
if (gtt->offset == AMDGPU_BO_INVALID_OFFSET)
1306-
return 0;
1306+
return;
13071307

13081308
/* unbind shouldn't be done for GDS/GWS/OA in ttm_bo_clean_mm */
13091309
r = amdgpu_gart_unbind(adev, gtt->offset, ttm->num_pages);
13101310
if (r)
13111311
DRM_ERROR("failed to unbind %lu pages at 0x%08llX\n",
13121312
gtt->ttm.ttm.num_pages, gtt->offset);
1313-
return r;
13141313
}
13151314

13161315
static void amdgpu_ttm_backend_destroy(struct ttm_tt *ttm)

drivers/gpu/drm/nouveau/nouveau_sgdma.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,11 @@ nv04_sgdma_bind(struct ttm_tt *ttm, struct ttm_mem_reg *reg)
4646
return 0;
4747
}
4848

49-
static int
49+
static void
5050
nv04_sgdma_unbind(struct ttm_tt *ttm)
5151
{
5252
struct nouveau_sgdma_be *nvbe = (struct nouveau_sgdma_be *)ttm;
5353
nouveau_mem_fini(nvbe->mem);
54-
return 0;
5554
}
5655

5756
static struct ttm_backend_func nv04_sgdma_backend = {

drivers/gpu/drm/qxl/qxl_ttm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,9 @@ static int qxl_ttm_backend_bind(struct ttm_tt *ttm,
149149
return -1;
150150
}
151151

152-
static int qxl_ttm_backend_unbind(struct ttm_tt *ttm)
152+
static void qxl_ttm_backend_unbind(struct ttm_tt *ttm)
153153
{
154154
/* Not implemented */
155-
return -1;
156155
}
157156

158157
static void qxl_ttm_backend_destroy(struct ttm_tt *ttm)

drivers/gpu/drm/radeon/radeon_ttm.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,16 +591,14 @@ static int radeon_ttm_backend_bind(struct ttm_tt *ttm,
591591
return 0;
592592
}
593593

594-
static int radeon_ttm_backend_unbind(struct ttm_tt *ttm)
594+
static void radeon_ttm_backend_unbind(struct ttm_tt *ttm)
595595
{
596596
struct radeon_ttm_tt *gtt = (void *)ttm;
597597

598598
radeon_gart_unbind(gtt->rdev, gtt->offset, ttm->num_pages);
599599

600600
if (gtt->userptr)
601601
radeon_ttm_tt_unpin_userptr(ttm);
602-
603-
return 0;
604602
}
605603

606604
static void radeon_ttm_backend_destroy(struct ttm_tt *ttm)

drivers/gpu/drm/ttm/ttm_agp_backend.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,18 @@ static int ttm_agp_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
8282
return ret;
8383
}
8484

85-
static int ttm_agp_unbind(struct ttm_tt *ttm)
85+
static void ttm_agp_unbind(struct ttm_tt *ttm)
8686
{
8787
struct ttm_agp_backend *agp_be = container_of(ttm, struct ttm_agp_backend, ttm);
8888

8989
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+
}
9294
agp_free_memory(agp_be->mem);
9395
agp_be->mem = NULL;
9496
}
95-
return 0;
9697
}
9798

9899
static void ttm_agp_destroy(struct ttm_tt *ttm)

drivers/gpu/drm/ttm/ttm_tt.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,8 @@ EXPORT_SYMBOL(ttm_dma_tt_fini);
313313

314314
void ttm_tt_unbind(struct ttm_tt *ttm)
315315
{
316-
int ret;
317-
318316
if (ttm->state == tt_bound) {
319-
ret = ttm->func->unbind(ttm);
320-
BUG_ON(ret);
317+
ttm->func->unbind(ttm);
321318
ttm->state = tt_unbound;
322319
}
323320
}

drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static int vmw_ttm_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
610610
return 0;
611611
}
612612

613-
static int vmw_ttm_unbind(struct ttm_tt *ttm)
613+
static void vmw_ttm_unbind(struct ttm_tt *ttm)
614614
{
615615
struct vmw_ttm_tt *vmw_be =
616616
container_of(ttm, struct vmw_ttm_tt, dma_ttm.ttm);
@@ -628,8 +628,6 @@ static int vmw_ttm_unbind(struct ttm_tt *ttm)
628628

629629
if (vmw_be->dev_priv->map_mode == vmw_dma_map_bind)
630630
vmw_ttm_unmap_dma(vmw_be);
631-
632-
return 0;
633631
}
634632

635633

include/drm/ttm/ttm_tt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct ttm_backend_func {
7070
* Unbind previously bound backend pages. This function should be
7171
* able to handle differences between aperture and system page sizes.
7272
*/
73-
int (*unbind) (struct ttm_tt *ttm);
73+
void (*unbind) (struct ttm_tt *ttm);
7474

7575
/**
7676
* struct ttm_backend_func member destroy

0 commit comments

Comments
 (0)