tools/power turbostat: cleanup 'automatic_cstate_conversion_probe()'
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Tue, 26 Jul 2022 15:29:33 +0000 (18:29 +0300)
committerLen Brown <len.brown@intel.com>
Thu, 28 Jul 2022 18:37:19 +0000 (14:37 -0400)
The 'automatic_cstate_conversion_probe()' function has a too long 'if'
statement, convert it to a 'switch' statement in order to improve code
readability a bit.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
tools/power/x86/turbostat/turbostat.c

index 33b74e1..3ec10d1 100644 (file)
@@ -4816,8 +4816,16 @@ void perf_limit_reasons_probe(unsigned int family, unsigned int model)
 
 void automatic_cstate_conversion_probe(unsigned int family, unsigned int model)
 {
-       if (is_skx(family, model) || is_bdx(family, model) || is_icx(family, model) || is_spr(family, model))
+       if (family != 6)
+               return;
+
+       switch (model) {
+       case INTEL_FAM6_BROADWELL_X:
+       case INTEL_FAM6_SKYLAKE_X:
+       case INTEL_FAM6_ICELAKE_X:
+       case INTEL_FAM6_SAPPHIRERAPIDS_X:
                has_automatic_cstate_conversion = 1;
+       }
 }
 
 void prewake_cstate_probe(unsigned int family, unsigned int model)