Simplify error path cleanup for IFPC-disable critical sections. Note that this moves where we re-enable IFPC until after the wake_up_all(), but that is harmless.
Reviewed-by: Konrad Dybcio <[email protected]> Reviewed-by: Anna Maniscalco <[email protected]> Signed-off-by: Rob Clark <[email protected]> --- drivers/gpu/drm/msm/msm_gpu.h | 4 ++++ drivers/gpu/drm/msm/msm_perfcntr.c | 5 +---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 0334a0f604ac..e7912d2180a5 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -399,6 +399,10 @@ msm_gpu_disable_ifpc_put(struct msm_gpu *gpu) gpu->funcs->ifpc_update(gpu); } +DEFINE_GUARD(ifpc_disable, struct msm_gpu *, + msm_gpu_disable_ifpc_get(_T), + msm_gpu_disable_ifpc_put(_T)) + /* * The number of priority levels provided by drm gpu scheduler. The * DRM_SCHED_PRIORITY_KERNEL priority level is treated specially in some diff --git a/drivers/gpu/drm/msm/msm_perfcntr.c b/drivers/gpu/drm/msm/msm_perfcntr.c index 867dd476ed88..995857273aca 100644 --- a/drivers/gpu/drm/msm/msm_perfcntr.c +++ b/drivers/gpu/drm/msm/msm_perfcntr.c @@ -259,7 +259,7 @@ sample_worker(struct kthread_work *work) } /* Inhibit IFPC while accessing registers: */ - msm_gpu_disable_ifpc_get(gpu); + guard(ifpc_disable)(gpu); if (gpu->funcs->perfcntr_flush) gpu->funcs->perfcntr_flush(gpu); @@ -295,9 +295,6 @@ sample_worker(struct kthread_work *work) } } - /* Re-enable IFPC: */ - msm_gpu_disable_ifpc_put(gpu); - smp_store_release(&stream->fifo.head, head); wake_up_all(&stream->poll_wq); } -- 2.56.0
