drm/i915/gvt: Factor out prepare_workload()
authorZhi Wang <zhi.a.wang@intel.com>
Tue, 12 Sep 2017 13:51:10 +0000 (21:51 +0800)
committerZhenyu Wang <zhenyuw@linux.intel.com>
Thu, 16 Nov 2017 03:46:53 +0000 (11:46 +0800)
Factor out prepare_workload() for the following re-factor.

Signed-off-by: Zhi Wang <zhi.a.wang@intel.com>
drivers/gpu/drm/i915/gvt/scheduler.c

index 10ccb05..3d1435f 100644 (file)
@@ -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: