]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: intel_pstate: Relocate platform preference check
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 7 Feb 2025 12:48:40 +0000 (13:48 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 21 Feb 2025 17:09:21 +0000 (18:09 +0100)
Move the invocation of intel_pstate_platform_pwr_mgmt_exists() before
checking whether or not HWP is enabled because it does not depend on
any code running before it except for the vendor check and if CPU
performance scaling is going to be carried out by the platform, all of
the code that runs before that function (again, except for the vendor
check) is redundant.

This is not expected to alter any functionality except for the ordering
of messages printed by intel_pstate_init() when it is going to return an
error before attempting to register the driver.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Link: https://patch.msgid.link/2776745.mvXUDI8C0e@rjwysocki.net
drivers/cpufreq/intel_pstate.c

index bc31e9b9b66035ede90b6666ed880da539770029..fa81054fa4114ed6a72b8e5a9b9eb0cf2f440465 100644 (file)
@@ -3694,6 +3694,15 @@ static int __init intel_pstate_init(void)
        if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
                return -ENODEV;
 
+       /*
+        * The Intel pstate driver will be ignored if the platform
+        * firmware has its own power management modes.
+        */
+       if (intel_pstate_platform_pwr_mgmt_exists()) {
+               pr_info("P-states controlled by the platform\n");
+               return -ENODEV;
+       }
+
        id = x86_match_cpu(hwp_support_ids);
        if (id) {
                hwp_forced = intel_pstate_hwp_is_enabled();
@@ -3749,15 +3758,6 @@ static int __init intel_pstate_init(void)
                default_driver = &intel_cpufreq;
 
 hwp_cpu_matched:
-       /*
-        * The Intel pstate driver will be ignored if the platform
-        * firmware has its own power management modes.
-        */
-       if (intel_pstate_platform_pwr_mgmt_exists()) {
-               pr_info("P-states controlled by the platform\n");
-               return -ENODEV;
-       }
-
        if (!hwp_active && hwp_only)
                return -ENOTSUPP;