cpufreq: intel_pstate: Simplify intel_cpufreq_update_pstate()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 12 Nov 2020 19:25:15 +0000 (20:25 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 11 Dec 2020 18:53:58 +0000 (19:53 +0100)
Avoid doing the same assignment in both branches of a conditional,
do it after the whole conditional instead.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/intel_pstate.c

index 36a3ccf..2a4db85 100644 (file)
@@ -2569,14 +2569,13 @@ static int intel_cpufreq_update_pstate(struct cpufreq_policy *policy,
        int old_pstate = cpu->pstate.current_pstate;
 
        target_pstate = intel_pstate_prepare_request(cpu, target_pstate);
-       if (hwp_active) {
+       if (hwp_active)
                intel_cpufreq_adjust_hwp(cpu, target_pstate,
                                         policy->strict_target, fast_switch);
-               cpu->pstate.current_pstate = target_pstate;
-       } else if (target_pstate != old_pstate) {
+       else if (target_pstate != old_pstate)
                intel_cpufreq_adjust_perf_ctl(cpu, target_pstate, fast_switch);
-               cpu->pstate.current_pstate = target_pstate;
-       }
+
+       cpu->pstate.current_pstate = target_pstate;
 
        intel_cpufreq_trace(cpu, fast_switch ? INTEL_PSTATE_TRACE_FAST_SWITCH :
                            INTEL_PSTATE_TRACE_TARGET, old_pstate);