[PATCH] platform/x86/amd/pmf: Remove redundant ternary operators

Liao Yuanhong posted 1 patch 1 month ago
drivers/platform/x86/amd/pmf/sps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] platform/x86/amd/pmf: Remove redundant ternary operators
Posted by Liao Yuanhong 1 month ago
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/platform/x86/amd/pmf/sps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
index 49e14ca94a9e..c28f3c5744c2 100644
--- a/drivers/platform/x86/amd/pmf/sps.c
+++ b/drivers/platform/x86/amd/pmf/sps.c
@@ -283,7 +283,7 @@ int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf)
 
 bool is_pprof_balanced(struct amd_pmf_dev *pmf)
 {
-	return (pmf->current_profile == PLATFORM_PROFILE_BALANCED) ? true : false;
+	return pmf->current_profile == PLATFORM_PROFILE_BALANCED;
 }
 
 static int amd_pmf_profile_get(struct device *dev,
-- 
2.34.1
Re: [PATCH] platform/x86/amd/pmf: Remove redundant ternary operators
Posted by Ilpo Järvinen 4 weeks, 1 day ago
On Thu, 28 Aug 2025 20:26:48 +0800, Liao Yuanhong wrote:

> For ternary operators in the form of "a ? true : false", if 'a' itself
> returns a boolean result, the ternary operator can be omitted. Remove
> redundant ternary operators to clean up the code.
> 
> 


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86/amd/pmf: Remove redundant ternary operators
      commit: f490253809c8dab4af62e787f5a3ac3d22aa869c

--
 i.