Some drivers perform the same operation to add a syncobj's fence to the sched as a dependency: first, call drm_syncobj_find_fence() to find the fence and then, call drm_sched_job_add_dependency(). Therefore, create a wrapper to encapsulate those steps in one single function. The first patch creates the wrapper for the operation and the following patches make the drivers use the new function drm_sched_job_add_syncobj_dependency(). v1 -> v2: https://lore.kernel.org/dri-devel/20230208194817.199932-1-mcanal@xxxxxxxxxx/T/ - Don't initialize any local return variables if it isn't necessary (Christian König). - Remove unused "fence" variable from msm. - Handle the -ENOENT case in v3d (Melissa Wen). - Add Christian's, Alyssa's, and Luben's Reviewed-by. Best Regards, - Maíra Canal Maíra Canal (5): drm/sched: Create wrapper to add a syncobj dependency to job drm/lima: Use drm_sched_job_add_syncobj_dependency() drm/msm: Use drm_sched_job_add_syncobj_dependency() drm/panfrost: Use drm_sched_job_add_syncobj_dependency() drm/v3d: Use drm_sched_job_add_syncobj_dependency() drivers/gpu/drm/lima/lima_gem.c | 12 ++-------- drivers/gpu/drm/msm/msm_gem_submit.c | 9 ++------ drivers/gpu/drm/panfrost/panfrost_drv.c | 11 ++-------- drivers/gpu/drm/scheduler/sched_main.c | 29 +++++++++++++++++++++++++ drivers/gpu/drm/v3d/v3d_gem.c | 22 ++++--------------- include/drm/gpu_scheduler.h | 6 +++++ 6 files changed, 45 insertions(+), 44 deletions(-) -- 2.39.1