<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; font-size: 12pt; color: rgb(50, 49, 48); background-color: rgba(0, 0, 0, 0);">this change doesn't make
 sense, </span><span style="background-color: rgba(0, 0, 0, 0); color: rgb(50, 49, 48); font-family: "segoe ui", "segoe ui web (west european)", "segoe ui", -apple-system, blinkmacsystemfont, roboto, "helvetica neue", sans-serif; font-size: 12pt;">and if you
 really think the return value is useless.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div></div>
</div>
<span>It is more reasonable to accept parameters with return value, not parameter.</span>
<div><span><span>I think these two patches make the code look worse, </span></span>unless there's a bug in it.</div>
<div><br>
</div>
<div>add <a id="OWAAM161346" class="_1OtrSZdhKXVv3UhaivrdJ4 mention ms-bgc-nlr ms-fcl-b" href="mailto:Ray.Huang@amd.com">@Huang, Ray</a> double check.<br>
</div>
<div><span><u><span></span><br>
</u></span></div>
<div><span>Best Regards,<br>
Kevin<br>
</span>
<div><br>
</div>
<span></span>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Evan Quan <evan.quan@amd.com><br>
<b>Sent:</b> Wednesday, December 4, 2019 5:53 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Subject:</b> [PATCH 1/2] drm/amd/powerplay: drop unnecessary API wrapper and return value</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Some minor cosmetic fixes.<br>
<br>
Change-Id: I3ec217289f4cb491720430f2d0b0b4efe5e2b9aa<br>
Signed-off-by: Evan Quan <evan.quan@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c    | 12 ++----<br>
 .../gpu/drm/amd/powerplay/inc/amdgpu_smu.h    |  2 +-<br>
 drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h |  2 +-<br>
 drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h |  2 +-<br>
 drivers/gpu/drm/amd/powerplay/smu_v11_0.c     | 39 +++++--------------<br>
 drivers/gpu/drm/amd/powerplay/smu_v12_0.c     | 22 ++---------<br>
 6 files changed, 19 insertions(+), 60 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index 2dd960e85a24..00a0df9b41c9 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -198,9 +198,7 @@ int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_t<br>
                 if (ret)<br>
                         return ret;<br>
 <br>
-               ret = smu_read_smc_arg(smu, if_version);<br>
-               if (ret)<br>
-                       return ret;<br>
+               smu_read_smc_arg(smu, if_version);<br>
         }<br>
 <br>
         if (smu_version) {<br>
@@ -208,9 +206,7 @@ int smu_get_smc_version(struct smu_context *smu, uint32_t *if_version, uint32_t<br>
                 if (ret)<br>
                         return ret;<br>
 <br>
-               ret = smu_read_smc_arg(smu, smu_version);<br>
-               if (ret)<br>
-                       return ret;<br>
+               smu_read_smc_arg(smu, smu_version);<br>
         }<br>
 <br>
         return ret;<br>
@@ -339,9 +335,7 @@ int smu_get_dpm_freq_by_index(struct smu_context *smu, enum smu_clk_type clk_typ<br>
         if (ret)<br>
                 return ret;<br>
 <br>
-       ret = smu_read_smc_arg(smu, &param);<br>
-       if (ret)<br>
-               return ret;<br>
+       smu_read_smc_arg(smu, &param);<br>
 <br>
         /* BIT31:  0 - Fine grained DPM, 1 - Dicrete DPM<br>
          * now, we un-support it */<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
index ca3fdc6777cf..e7b18b209bc7 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h<br>
@@ -502,7 +502,7 @@ struct pptable_funcs {<br>
         int (*system_features_control)(struct smu_context *smu, bool en);<br>
         int (*send_smc_msg_with_param)(struct smu_context *smu,<br>
                                        enum smu_message_type msg, uint32_t param);<br>
-       int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);<br>
+       void (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);<br>
         int (*init_display_count)(struct smu_context *smu, uint32_t count);<br>
         int (*set_allowed_mask)(struct smu_context *smu);<br>
         int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h<br>
index 610e301a5fce..4160147a03f3 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v11_0.h<br>
@@ -183,7 +183,7 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu,<br>
                               enum smu_message_type msg,<br>
                               uint32_t param);<br>
 <br>
-int smu_v11_0_read_arg(struct smu_context *smu, uint32_t *arg);<br>
+void smu_v11_0_read_arg(struct smu_context *smu, uint32_t *arg);<br>
 <br>
 int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count);<br>
 <br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h<br>
index 922973b7e29f..710af2860a8f 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/smu_v12_0.h<br>
@@ -40,7 +40,7 @@ struct smu_12_0_cmn2aisc_mapping {<br>
 int smu_v12_0_send_msg_without_waiting(struct smu_context *smu,<br>
                                               uint16_t msg);<br>
 <br>
-int smu_v12_0_read_arg(struct smu_context *smu, uint32_t *arg);<br>
+void smu_v12_0_read_arg(struct smu_context *smu, uint32_t *arg);<br>
 <br>
 int smu_v12_0_wait_for_response(struct smu_context *smu);<br>
 <br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
index 8683e0678b56..325ec4864f90 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c<br>
@@ -53,20 +53,11 @@ MODULE_FIRMWARE("amdgpu/navi12_smc.bin");<br>
 <br>
 #define SMU11_VOLTAGE_SCALE 4<br>
 <br>
-static int smu_v11_0_send_msg_without_waiting(struct smu_context *smu,<br>
-                                             uint16_t msg)<br>
-{<br>
-       struct amdgpu_device *adev = smu->adev;<br>
-       WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);<br>
-       return 0;<br>
-}<br>
-<br>
-int smu_v11_0_read_arg(struct smu_context *smu, uint32_t *arg)<br>
+void smu_v11_0_read_arg(struct smu_context *smu, uint32_t *arg)<br>
 {<br>
         struct amdgpu_device *adev = smu->adev;<br>
 <br>
         *arg = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_82);<br>
-       return 0;<br>
 }<br>
 <br>
 static int smu_v11_0_wait_for_response(struct smu_context *smu)<br>
@@ -109,7 +100,7 @@ smu_v11_0_send_msg_with_param(struct smu_context *smu,<br>
 <br>
         WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_82, param);<br>
 <br>
-       smu_v11_0_send_msg_without_waiting(smu, (uint16_t)index);<br>
+       WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_66, (uint16_t)index);<br>
 <br>
         ret = smu_v11_0_wait_for_response(smu);<br>
         if (ret)<br>
@@ -843,16 +834,12 @@ int smu_v11_0_get_enabled_mask(struct smu_context *smu,<br>
         ret = smu_send_smc_msg(smu, SMU_MSG_GetEnabledSmuFeaturesHigh);<br>
         if (ret)<br>
                 return ret;<br>
-       ret = smu_read_smc_arg(smu, &feature_mask_high);<br>
-       if (ret)<br>
-               return ret;<br>
+       smu_read_smc_arg(smu, &feature_mask_high);<br>
 <br>
         ret = smu_send_smc_msg(smu, SMU_MSG_GetEnabledSmuFeaturesLow);<br>
         if (ret)<br>
                 return ret;<br>
-       ret = smu_read_smc_arg(smu, &feature_mask_low);<br>
-       if (ret)<br>
-               return ret;<br>
+       smu_read_smc_arg(smu, &feature_mask_low);<br>
 <br>
         feature_mask[0] = feature_mask_low;<br>
         feature_mask[1] = feature_mask_high;<br>
@@ -924,9 +911,7 @@ smu_v11_0_get_max_sustainable_clock(struct smu_context *smu, uint32_t *clock,<br>
                 return ret;<br>
         }<br>
 <br>
-       ret = smu_read_smc_arg(smu, clock);<br>
-       if (ret)<br>
-               return ret;<br>
+       smu_read_smc_arg(smu, clock);<br>
 <br>
         if (*clock != 0)<br>
                 return 0;<br>
@@ -939,7 +924,7 @@ smu_v11_0_get_max_sustainable_clock(struct smu_context *smu, uint32_t *clock,<br>
                 return ret;<br>
         }<br>
 <br>
-       ret = smu_read_smc_arg(smu, clock);<br>
+       smu_read_smc_arg(smu, clock);<br>
 <br>
         return ret;<br>
 }<br>
@@ -1107,9 +1092,7 @@ int smu_v11_0_get_current_clk_freq(struct smu_context *smu,<br>
                 if (ret)<br>
                         return ret;<br>
 <br>
-               ret = smu_read_smc_arg(smu, &freq);<br>
-               if (ret)<br>
-                       return ret;<br>
+               smu_read_smc_arg(smu, &freq);<br>
         }<br>
 <br>
         freq *= 100;<br>
@@ -1749,18 +1732,14 @@ int smu_v11_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk_type c<br>
                 ret = smu_send_smc_msg_with_param(smu, SMU_MSG_GetMaxDpmFreq, param);<br>
                 if (ret)<br>
                         goto failed;<br>
-               ret = smu_read_smc_arg(smu, max);<br>
-               if (ret)<br>
-                       goto failed;<br>
+               smu_read_smc_arg(smu, max);<br>
         }<br>
 <br>
         if (min) {<br>
                 ret = smu_send_smc_msg_with_param(smu, SMU_MSG_GetMinDpmFreq, param);<br>
                 if (ret)<br>
                         goto failed;<br>
-               ret = smu_read_smc_arg(smu, min);<br>
-               if (ret)<br>
-                       goto failed;<br>
+               smu_read_smc_arg(smu, min);<br>
         }<br>
 <br>
 failed:<br>
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
index 269a7d73b58d..7f5f7e12a41e 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/smu_v12_0.c<br>
@@ -41,21 +41,11 @@<br>
 #define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS_MASK          0x00000006L<br>
 #define SMUIO_GFX_MISC_CNTL__PWR_GFXOFF_STATUS__SHIFT        0x1<br>
 <br>
-int smu_v12_0_send_msg_without_waiting(struct smu_context *smu,<br>
-                                             uint16_t msg)<br>
-{<br>
-       struct amdgpu_device *adev = smu->adev;<br>
-<br>
-       WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_66, msg);<br>
-       return 0;<br>
-}<br>
-<br>
-int smu_v12_0_read_arg(struct smu_context *smu, uint32_t *arg)<br>
+void smu_v12_0_read_arg(struct smu_context *smu, uint32_t *arg)<br>
 {<br>
         struct amdgpu_device *adev = smu->adev;<br>
 <br>
         *arg = RREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_82);<br>
-       return 0;<br>
 }<br>
 <br>
 int smu_v12_0_wait_for_response(struct smu_context *smu)<br>
@@ -98,7 +88,7 @@ smu_v12_0_send_msg_with_param(struct smu_context *smu,<br>
 <br>
         WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_82, param);<br>
 <br>
-       smu_v12_0_send_msg_without_waiting(smu, (uint16_t)index);<br>
+       WREG32_SOC15(MP1, 0, mmMP1_SMN_C2PMSG_66, (uint16_t)index);<br>
 <br>
         ret = smu_v12_0_wait_for_response(smu);<br>
         if (ret)<br>
@@ -352,9 +342,7 @@ int smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk_type c<br>
                                 pr_err("Attempt to get max GX frequency from SMC Failed !\n");<br>
                                 goto failed;<br>
                         }<br>
-                       ret = smu_read_smc_arg(smu, max);<br>
-                       if (ret)<br>
-                               goto failed;<br>
+                       smu_read_smc_arg(smu, max);<br>
                         break;<br>
                 case SMU_UCLK:<br>
                 case SMU_FCLK:<br>
@@ -383,9 +371,7 @@ int smu_v12_0_get_dpm_ultimate_freq(struct smu_context *smu, enum smu_clk_type c<br>
                                 pr_err("Attempt to get min GX frequency from SMC Failed !\n");<br>
                                 goto failed;<br>
                         }<br>
-                       ret = smu_read_smc_arg(smu, min);<br>
-                       if (ret)<br>
-                               goto failed;<br>
+                       smu_read_smc_arg(smu, min);<br>
                         break;<br>
                 case SMU_UCLK:<br>
                 case SMU_FCLK:<br>
-- <br>
2.24.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CKevin1.Wang%40amd.com%7Cb2381beaed6e4f83074608d7789fe6ef%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637110500489978071&amp;sdata=U15cqXp2n00LRZDeu2482cwoZmEIrXWHCgF4NFap%2BkQ%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7CKevin1.Wang%40amd.com%7Cb2381beaed6e4f83074608d7789fe6ef%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637110500489978071&amp;sdata=U15cqXp2n00LRZDeu2482cwoZmEIrXWHCgF4NFap%2BkQ%3D&amp;reserved=0</a></div>
</span></font></div>
</div>
</div>
</body>
</html>