[PATCH] drm/amdgpu: Drop redundant parameter in amdgpu_gfx_kiq_init_ring

Deucher, Alexander Alexander.Deucher at amd.com
Mon Feb 19 18:58:48 UTC 2024


[Public]

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
________________________________
From: Ma, Jun <Jun.Ma2 at amd.com>
Sent: Monday, February 19, 2024 1:40 AM
To: amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>; Koenig, Christian <Christian.Koenig at amd.com>; Deucher, Alexander <Alexander.Deucher at amd.com>
Cc: Ma, Jun <Jun.Ma2 at amd.com>
Subject: [PATCH] drm/amdgpu: Drop redundant parameter in amdgpu_gfx_kiq_init_ring

Drop redundant parameters in function amdgpu_gfx_kiq_init_ring
to simplify the code

Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 6 +++---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 4 +---
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c  | 5 ++---
 drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c  | 5 ++---
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 5 ++---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 5 ++---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 4 +---
 7 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
index e114694d1131..4835d6d899e7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
@@ -304,11 +304,11 @@ static int amdgpu_gfx_kiq_acquire(struct amdgpu_device *adev,
         return -EINVAL;
 }

-int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev,
-                            struct amdgpu_ring *ring,
-                            struct amdgpu_irq_src *irq, int xcc_id)
+int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, int xcc_id)
 {
         struct amdgpu_kiq *kiq = &adev->gfx.kiq[xcc_id];
+       struct amdgpu_irq_src *irq = &kiq->irq;
+       struct amdgpu_ring *ring = &kiq->ring;
         int r = 0;

         spin_lock_init(&kiq->ring_lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
index f23bafec71c5..8fcf889ddce9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h
@@ -471,9 +471,7 @@ static inline u32 amdgpu_gfx_create_bitmask(u32 bit_width)
 void amdgpu_gfx_parse_disable_cu(unsigned *mask, unsigned max_se,
                                  unsigned max_sh);

-int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev,
-                            struct amdgpu_ring *ring,
-                            struct amdgpu_irq_src *irq, int xcc_id);
+int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, int xcc_id);

 void amdgpu_gfx_kiq_free_ring(struct amdgpu_ring *ring);

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
index b02d63328f1c..691fa40e4e01 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
@@ -4490,7 +4490,7 @@ static int gfx_v10_0_compute_ring_init(struct amdgpu_device *adev, int ring_id,
 static int gfx_v10_0_sw_init(void *handle)
 {
         int i, j, k, r, ring_id = 0;
-       struct amdgpu_kiq *kiq;
+       int xcc_id = 0;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;

         switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
@@ -4619,8 +4619,7 @@ static int gfx_v10_0_sw_init(void *handle)
                         return r;
                 }

-               kiq = &adev->gfx.kiq[0];
-               r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0);
+               r = amdgpu_gfx_kiq_init_ring(adev, xcc_id);
                 if (r)
                         return r;
         }
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
index 2fb1342d5bd9..9d8ec709cd52 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
@@ -1329,7 +1329,7 @@ static int gfx_v11_0_rlc_backdoor_autoload_enable(struct amdgpu_device *adev)
 static int gfx_v11_0_sw_init(void *handle)
 {
         int i, j, k, r, ring_id = 0;
-       struct amdgpu_kiq *kiq;
+       int xcc_id = 0;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;

         switch (amdgpu_ip_version(adev, GC_HWIP, 0)) {
@@ -1454,8 +1454,7 @@ static int gfx_v11_0_sw_init(void *handle)
                         return r;
                 }

-               kiq = &adev->gfx.kiq[0];
-               r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0);
+               r = amdgpu_gfx_kiq_init_ring(adev, xcc_id);
                 if (r)
                         return r;
         }
diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index ea174b76ee70..b97ea62212b6 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -1900,8 +1900,8 @@ static void gfx_v8_0_sq_irq_work_func(struct work_struct *work);
 static int gfx_v8_0_sw_init(void *handle)
 {
         int i, j, k, r, ring_id;
+       int xcc_id = 0;
         struct amdgpu_ring *ring;
-       struct amdgpu_kiq *kiq;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;

         switch (adev->asic_type) {
@@ -2022,8 +2022,7 @@ static int gfx_v8_0_sw_init(void *handle)
                 return r;
         }

-       kiq = &adev->gfx.kiq[0];
-       r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0);
+       r = amdgpu_gfx_kiq_init_ring(adev, xcc_id);
         if (r)
                 return r;

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
index 169d45268ef6..7669f82aa1da 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
@@ -1997,8 +1997,8 @@ static int gfx_v9_0_compute_ring_init(struct amdgpu_device *adev, int ring_id,
 static int gfx_v9_0_sw_init(void *handle)
 {
         int i, j, k, r, ring_id;
+       int xcc_id = 0;
         struct amdgpu_ring *ring;
-       struct amdgpu_kiq *kiq;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;
         unsigned int hw_prio;

@@ -2151,8 +2151,7 @@ static int gfx_v9_0_sw_init(void *handle)
                 return r;
         }

-       kiq = &adev->gfx.kiq[0];
-       r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, 0);
+       r = amdgpu_gfx_kiq_init_ring(adev, xcc_id);
         if (r)
                 return r;

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index aace4594a603..ec92c3c2080b 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
@@ -843,7 +843,6 @@ static int gfx_v9_4_3_compute_ring_init(struct amdgpu_device *adev, int ring_id,
 static int gfx_v9_4_3_sw_init(void *handle)
 {
         int i, j, k, r, ring_id, xcc_id, num_xcc;
-       struct amdgpu_kiq *kiq;
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;

         adev->gfx.mec.num_mec = 2;
@@ -912,8 +911,7 @@ static int gfx_v9_4_3_sw_init(void *handle)
                         return r;
                 }

-               kiq = &adev->gfx.kiq[xcc_id];
-               r = amdgpu_gfx_kiq_init_ring(adev, &kiq->ring, &kiq->irq, xcc_id);
+               r = amdgpu_gfx_kiq_init_ring(adev, xcc_id);
                 if (r)
                         return r;

--
2.34.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20240219/4b568218/attachment.htm>


More information about the amd-gfx mailing list