This will simplify code.

Signed-off-by: Guchun Chen <guchun.c...@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 9 ++-------
 drivers/gpu/drm/amd/amdgpu/mes_v10_1.c  | 8 +-------
 drivers/gpu/drm/amd/amdgpu/mes_v11_0.c  | 7 +------
 drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c  | 8 ++------
 4 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
index f0f00466b59f..49bb6c03d606 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -1305,14 +1305,9 @@ static int amdgpu_mes_test_queues(struct amdgpu_ring 
**added_rings)
                if (!ring)
                        continue;
 
-               r = amdgpu_ring_test_ring(ring);
-               if (r) {
-                       DRM_DEV_ERROR(ring->adev->dev,
-                                     "ring %s test failed (%d)\n",
-                                     ring->name, r);
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
                        return r;
-               } else
-                       DRM_INFO("ring %s test pass\n", ring->name);
 
                r = amdgpu_ring_test_ib(ring, 1000 * 10);
                if (r) {
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c 
b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
index 4560476c7c31..af66e985a33a 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v10_1.c
@@ -812,13 +812,7 @@ static int mes_v10_1_kiq_enable_queue(struct amdgpu_device 
*adev)
 
        kiq->pmf->kiq_map_queues(kiq_ring, &adev->mes.ring);
 
-       r = amdgpu_ring_test_ring(kiq_ring);
-       if (r) {
-               DRM_ERROR("kfq enable failed\n");
-               kiq_ring->sched.ready = false;
-       }
-
-       return r;
+       return amdgpu_ring_test_helper(kiq_ring);
 }
 
 static int mes_v10_1_queue_init(struct amdgpu_device *adev)
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c 
b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
index 3adb450eec07..b8eabb37d48d 100644
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c
@@ -879,12 +879,7 @@ static int mes_v11_0_kiq_enable_queue(struct amdgpu_device 
*adev)
 
        kiq->pmf->kiq_map_queues(kiq_ring, &adev->mes.ring);
 
-       r = amdgpu_ring_test_ring(kiq_ring);
-       if (r) {
-               DRM_ERROR("kfq enable failed\n");
-               kiq_ring->sched.ready = false;
-       }
-       return r;
+       return amdgpu_ring_test_helper(kiq_ring);
 }
 
 static int mes_v11_0_queue_init(struct amdgpu_device *adev,
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
index 23667605c372..3f722d21b17f 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c
@@ -622,13 +622,9 @@ static int sdma_v5_2_gfx_resume(struct amdgpu_device *adev)
                        sdma_v5_2_enable(adev, true);
                }
 
-               r = amdgpu_ring_test_ring(ring);
-               if (r) {
-                       ring->sched.ready = false;
+               r = amdgpu_ring_test_helper(ring);
+               if (r)
                        return r;
-               }
-
-               ring->sched.ready = true;
 
                if (adev->mman.buffer_funcs_ring == ring)
                        amdgpu_ttm_set_buffer_funcs_status(adev, true);
-- 
2.25.1

Reply via email to