]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cpupower: Condense pstate enabled bit checks in decode_pstates()
authorNathan Fontenot <nathan.fontenot@amd.com>
Mon, 25 Jan 2021 17:35:23 +0000 (11:35 -0600)
committerShuah Khan <skhan@linuxfoundation.org>
Tue, 26 Jan 2021 16:40:32 +0000 (09:40 -0700)
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>
tools/power/cpupower/utils/helpers/amd.c

index b4731daa682059ac5fe768a5bedebde8e01b0318..216240e2b7710d6bbf3c4016ba70ea95fd2caffe 100644 (file)
@@ -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);