kfree(q);
 }
 
+void xe_exec_queue_assign_name(struct xe_exec_queue *q, u32 instance)
+{
+       switch (q->class) {
+       case XE_ENGINE_CLASS_RENDER:
+               sprintf(q->name, "rcs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_VIDEO_DECODE:
+               sprintf(q->name, "vcs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_VIDEO_ENHANCE:
+               sprintf(q->name, "vecs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_COPY:
+               sprintf(q->name, "bcs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_COMPUTE:
+               sprintf(q->name, "ccs%d", instance);
+               break;
+       default:
+               XE_WARN_ON(q->class);
+       }
+}
+
 struct xe_exec_queue *xe_exec_queue_lookup(struct xe_file *xef, u32 id)
 {
        struct xe_exec_queue *q;
 
 
 void xe_exec_queue_fini(struct xe_exec_queue *q);
 void xe_exec_queue_destroy(struct kref *ref);
+void xe_exec_queue_assign_name(struct xe_exec_queue *q, u32 instance);
 
 struct xe_exec_queue *xe_exec_queue_lookup(struct xe_file *xef, u32 id);
 
 
        q->execlist = exl;
        q->entity = &exl->entity;
 
-       switch (q->class) {
-       case XE_ENGINE_CLASS_RENDER:
-               sprintf(q->name, "rcs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_DECODE:
-               sprintf(q->name, "vcs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_ENHANCE:
-               sprintf(q->name, "vecs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_COPY:
-               sprintf(q->name, "bcs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_COMPUTE:
-               sprintf(q->name, "ccs%d", ffs(q->logical_mask) - 1);
-               break;
-       default:
-               XE_WARN_ON(q->class);
-       }
+       xe_exec_queue_assign_name(q, ffs(q->logical_mask) - 1);
 
        return 0;
 
 
 
        mutex_unlock(&guc->submission_state.lock);
 
-       switch (q->class) {
-       case XE_ENGINE_CLASS_RENDER:
-               sprintf(q->name, "rcs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_DECODE:
-               sprintf(q->name, "vcs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_ENHANCE:
-               sprintf(q->name, "vecs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_COPY:
-               sprintf(q->name, "bcs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_COMPUTE:
-               sprintf(q->name, "ccs%d", q->guc->id);
-               break;
-       default:
-               XE_WARN_ON(q->class);
-       }
+       xe_exec_queue_assign_name(q, q->guc->id);
 
        trace_xe_exec_queue_create(q);