Skip to content

Commit b2576f6

Browse files
Pranjal Ramajor Asha Kanojiyaquic-jhugo
authored andcommitted
accel/qaic: Create a function to initialize BO
This makes sure that we have a single place to initialize and re-initialize BO. Use this new API to cleanup release_dbc() We will need this for next patch to detach slicing to a BO. Signed-off-by: Pranjal Ramajor Asha Kanojiya <[email protected]> Reviewed-by: Jeffrey Hugo <[email protected]> Signed-off-by: Jeffrey Hugo <[email protected]> Reviewed-by: Stanislaw Gruszka <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0a9ee93 commit b2576f6

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

drivers/accel/qaic/qaic_data.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,18 @@ static const struct drm_gem_object_funcs qaic_gem_funcs = {
635635
.vm_ops = &drm_vm_ops,
636636
};
637637

638+
static void qaic_init_bo(struct qaic_bo *bo, bool reinit)
639+
{
640+
if (reinit) {
641+
bo->sliced = false;
642+
reinit_completion(&bo->xfer_done);
643+
} else {
644+
init_completion(&bo->xfer_done);
645+
}
646+
complete_all(&bo->xfer_done);
647+
INIT_LIST_HEAD(&bo->slices);
648+
}
649+
638650
static struct qaic_bo *qaic_alloc_init_bo(void)
639651
{
640652
struct qaic_bo *bo;
@@ -643,9 +655,7 @@ static struct qaic_bo *qaic_alloc_init_bo(void)
643655
if (!bo)
644656
return ERR_PTR(-ENOMEM);
645657

646-
INIT_LIST_HEAD(&bo->slices);
647-
init_completion(&bo->xfer_done);
648-
complete_all(&bo->xfer_done);
658+
qaic_init_bo(bo, false);
649659

650660
return bo;
651661
}
@@ -1880,9 +1890,7 @@ void release_dbc(struct qaic_device *qdev, u32 dbc_id)
18801890
list_for_each_entry_safe(bo, bo_temp, &dbc->bo_lists, bo_list) {
18811891
qaic_free_slices_bo(bo);
18821892
qaic_unprepare_bo(qdev, bo);
1883-
bo->sliced = false;
1884-
INIT_LIST_HEAD(&bo->slices);
1885-
init_completion(&bo->xfer_done);
1893+
qaic_init_bo(bo, true);
18861894
list_del(&bo->bo_list);
18871895
}
18881896

0 commit comments

Comments
 (0)