[PATCH v1] drm/amd/pm: replace manual string choices with standard helpers

Yan Zhen yanzhen at vivo.com
Wed Jun 18 01:09:03 UTC 2025


Use Linux kernel-provided helper functions from <linux/string_choices.h>:
- str_enabled_disabled()

to replace manual ternary expressions like:
  enable ? "enabled" : "disabled"

This improves code readability and ensures consistency
with kernel coding style.

No functional change.

Signed-off-by: Yan Zhen <yanzhen at vivo.com>
---
 drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
index 9ace863792d4..4c8a1fe59b4e 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
@@ -25,7 +25,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
-
+#include <linux/string_choices.h>
 #include "hwmgr.h"
 #include "amd_powerplay.h"
 #include "hardwaremanager.h"
@@ -3012,7 +3012,7 @@ static int vega10_enable_disable_PCC_limit_feature(struct pp_hwmgr *hwmgr, bool
 
 	if (data->smu_features[GNLD_PCC_LIMIT].supported) {
 		if (enable == data->smu_features[GNLD_PCC_LIMIT].enabled)
-			pr_info("GNLD_PCC_LIMIT has been %s \n", enable ? "enabled" : "disabled");
+			pr_info("GNLD_PCC_LIMIT has been %s\n", str_enabled_disabled(enable));
 		PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr,
 				enable, data->smu_features[GNLD_PCC_LIMIT].smu_feature_bitmap),
 				"Attempt to Enable PCC Limit feature Failed!",
-- 
2.34.1



More information about the dri-devel mailing list