Skip to content

Commit ed7cad0

Browse files
committed
cpufreq: intel_pstate: Relocate platform preference check
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 <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 3698dd6 commit ed7cad0

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/cpufreq/intel_pstate.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3694,6 +3694,15 @@ static int __init intel_pstate_init(void)
36943694
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL)
36953695
return -ENODEV;
36963696

3697+
/*
3698+
* The Intel pstate driver will be ignored if the platform
3699+
* firmware has its own power management modes.
3700+
*/
3701+
if (intel_pstate_platform_pwr_mgmt_exists()) {
3702+
pr_info("P-states controlled by the platform\n");
3703+
return -ENODEV;
3704+
}
3705+
36973706
id = x86_match_cpu(hwp_support_ids);
36983707
if (id) {
36993708
hwp_forced = intel_pstate_hwp_is_enabled();
@@ -3749,15 +3758,6 @@ static int __init intel_pstate_init(void)
37493758
default_driver = &intel_cpufreq;
37503759

37513760
hwp_cpu_matched:
3752-
/*
3753-
* The Intel pstate driver will be ignored if the platform
3754-
* firmware has its own power management modes.
3755-
*/
3756-
if (intel_pstate_platform_pwr_mgmt_exists()) {
3757-
pr_info("P-states controlled by the platform\n");
3758-
return -ENODEV;
3759-
}
3760-
37613761
if (!hwp_active && hwp_only)
37623762
return -ENOTSUPP;
37633763

0 commit comments

Comments
 (0)