summary refs log tree commit diff
path: root/tools/power
diff options
context:
space:
mode:
authorNathan Fontenot <nathan.fontenot@amd.com>2021-01-25 11:35:23 -0600
committerShuah Khan <skhan@linuxfoundation.org>2021-01-26 09:40:32 -0700
commit56a85eebebdba62ebf6c46bd957949cc6e926aa0 (patch)
tree7105b31a86f4fbfad93c41007b4f915e8225ba02 /tools/power
parent23765b82a808da416b70b41d711468e723531e6a (diff)
downloadlinux-56a85eebebdba62ebf6c46bd957949cc6e926aa0.tar.gz
cpupower: Condense pstate enabled bit checks in decode_pstates()
The enabled bit (bit 63) is common for all families so we can remove
the multiple enabled checks based on family and have a common check
for HW pstate enabled.

Signed-off-by: Nathan Fontenot <nathan.fontenot@amd.com>
Reviewed-by: Robert Richter <rrichter@amd.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/cpupower/utils/helpers/amd.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c
index b4731daa6820..216240e2b771 100644
--- a/tools/power/cpupower/utils/helpers/amd.c
+++ b/tools/power/cpupower/utils/helpers/amd.c
@@ -113,9 +113,9 @@ int decode_pstates(unsigned int cpu, unsigned int cpu_family,
 		}
 		if (read_msr(cpu, MSR_AMD_PSTATE + i, &pstate.val))
 			return -1;
-		if ((cpu_family == 0x17) && (!pstate.pstatedef.en))
-			continue;
-		else if (!pstate.pstate.en)
+
+		/* The enabled bit (bit 63) is common for all families */
+		if (!pstate.pstatedef.en)
 			continue;
 
 		pstates[i] = get_cof(cpu_family, pstate);