From 497aa3f5e3bdb6bea5994f7075e2f2df2377d70e Mon Sep 17 00:00:00 2001 From: Zhi Wang Date: Tue, 12 Sep 2017 21:51:10 +0800 Subject: [PATCH] drm/i915/gvt: Factor out prepare_workload() Factor out prepare_workload() for the following re-factor. Signed-off-by: Zhi Wang --- drivers/gpu/drm/i915/gvt/scheduler.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c index 10ccb05d0e8d..3d1435f55c7b 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.c +++ b/drivers/gpu/drm/i915/gvt/scheduler.c @@ -325,6 +325,16 @@ err_scan: return ret; } +static int prepare_workload(struct intel_vgpu_workload *workload) +{ + int ret = 0; + + if (workload->prepare) + ret = workload->prepare(workload); + + return ret; +} + static int dispatch_workload(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; @@ -344,12 +354,10 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) if (ret) goto out; - if (workload->prepare) { - ret = workload->prepare(workload); - if (ret) { - engine->context_unpin(engine, shadow_ctx); - goto out; - } + ret = prepare_workload(workload); + if (ret) { + engine->context_unpin(engine, shadow_ctx); + goto out; } out: -- 2.30.2