[PATCH v1] drivers:smumgr:Use min macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Instead of using the min() implementation of 
the ternary operator, use real macros.

Signed-off-by: Yang Ruibin <11162571@xxxxxxxx>
---
 drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c      | 5 +----
 drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c | 7 ++-----
 drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c     | 5 +----
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
index 5e43ad2b2..8bf80f65f 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/fiji_smumgr.c
@@ -1067,10 +1067,7 @@ static int fiji_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 						(1 << (lowest_pcie_level_enabled + 1 + count))) == 0))
 			count++;
 
-		mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) <
-				hightest_pcie_level_enabled ?
-						(lowest_pcie_level_enabled + 1 + count) :
-						hightest_pcie_level_enabled;
+		mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count,
+						hightest_pcie_level_enabled);

 		/* set pcieDpmLevel to hightest_pcie_level_enabled */
 		for (i = 2; i < dpm_table->sclk_table.count; i++)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
index ff6b563ec..62d9156ef 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
@@ -1127,11 +1127,8 @@ static int polaris10_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 						(1 << (lowest_pcie_level_enabled + 1 + count))) == 0))
 			count++;
 
-		mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) <
-				hightest_pcie_level_enabled ?
-						(lowest_pcie_level_enabled + 1 + count) :
-						hightest_pcie_level_enabled;
-
+		mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count,
+						hightest_pcie_level_enabled);

 		/* set pcieDpmLevel to hightest_pcie_level_enabled */
 		for (i = 2; i < dpm_table->sclk_table.count; i++)
 			levels[i].pcieDpmLevel = hightest_pcie_level_enabled;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c
index 34c9f59b8..4616c3261 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/vegam_smumgr.c
@@ -938,10 +938,7 @@ static int vegam_populate_all_graphic_levels(struct pp_hwmgr *hwmgr)
 						(1 << (lowest_pcie_level_enabled + 1 + count))) == 0))
 			count++;
 
-		mid_pcie_level_enabled = (lowest_pcie_level_enabled + 1 + count) <
-				hightest_pcie_level_enabled ?
-						(lowest_pcie_level_enabled + 1 + count) :
-						hightest_pcie_level_enabled;
+		mid_pcie_level_enabled = min(lowest_pcie_level_enabled + 1 + count,
+						hightest_pcie_level_enabled);

 		/* set pcieDpmLevel to hightest_pcie_level_enabled */
 		for (i = 2; i < dpm_table->sclk_table.count; i++)
-- 
2.34.1




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux