diff options
author | Evan Quan | 2022-05-25 16:51:47 +0800 |
---|---|---|
committer | Alex Deucher | 2022-06-08 11:42:44 -0400 |
commit | 6f73d6762694c3e91c49e6708077a0de2a75f2f5 (patch) | |
tree | fcd4e050b14f68dbc25533d5802fab7ce2ae66cd /drivers/gpu/drm/amd/pm | |
parent | bb50bba9c6c741f5e359f009dde3b25f12a84e3d (diff) |
drm/amd/pm: optimize the interface for dpm feature status query
Drop extra CMN2ASIC_MAPPING_FEATURE transform. Also some cosmetic
fixes for better readability.
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm')
-rw-r--r-- | drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c index 53cd62ccab5d..15e4298c7cc8 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c @@ -682,16 +682,13 @@ static const char *smu_get_feature_name(struct smu_context *smu, size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu, char *buf) { + int8_t sort_feature[max(SMU_FEATURE_COUNT, SMU_FEATURE_MAX)]; uint64_t feature_mask; - int feature_index = 0; + int i, feature_index; uint32_t count = 0; - int8_t sort_feature[SMU_FEATURE_COUNT]; size_t size = 0; - int ret = 0, i; - int feature_id; - ret = __smu_get_enabled_features(smu, &feature_mask); - if (ret) + if (__smu_get_enabled_features(smu, &feature_mask)) return 0; size = sysfs_emit_at(buf, size, "features high: 0x%08x low: 0x%08x\n", @@ -712,22 +709,15 @@ size_t smu_cmn_get_pp_feature_mask(struct smu_context *smu, size += sysfs_emit_at(buf, size, "%-2s. %-20s %-3s : %-s\n", "No", "Feature", "Bit", "State"); - for (i = 0; i < SMU_FEATURE_COUNT; i++) { - if (sort_feature[i] < 0) - continue; - - /* convert to asic spcific feature ID */ - feature_id = smu_cmn_to_asic_specific_index(smu, - CMN2ASIC_MAPPING_FEATURE, - sort_feature[i]); - if (feature_id < 0) + for (feature_index = 0; feature_index < SMU_FEATURE_MAX; feature_index++) { + if (sort_feature[feature_index] < 0) continue; size += sysfs_emit_at(buf, size, "%02d. %-20s (%2d) : %s\n", count++, - smu_get_feature_name(smu, sort_feature[i]), - i, - !!test_bit(feature_id, (unsigned long *)&feature_mask) ? + smu_get_feature_name(smu, sort_feature[feature_index]), + feature_index, + !!test_bit(feature_index, (unsigned long *)&feature_mask) ? "enabled" : "disabled"); } |