Skip to content
  • Rafael J. Wysocki's avatar
    b989bc0f
    cpufreq: intel_pstate: Simplify intel_pstate_update_perf_limits() · b989bc0f
    Rafael J. Wysocki authored
    
    
    Because pstate.max_freq is always equal to the product of
    pstate.max_pstate and pstate.scaling and, analogously,
    pstate.turbo_freq is always equal to the product of
    pstate.turbo_pstate and pstate.scaling, the result of the
    max_policy_perf computation in intel_pstate_update_perf_limits() is
    always equal to the quotient of policy_max and pstate.scaling,
    regardless of whether or not turbo is disabled.  Analogously, the
    result of min_policy_perf in intel_pstate_update_perf_limits() is
    always equal to the quotient of policy_min and pstate.scaling.
    
    Accordingly, intel_pstate_update_perf_limits() need not check
    whether or not turbo is enabled at all and in order to compute
    max_policy_perf and min_policy_perf it can always divide policy_max
    and policy_min, respectively, by pstate.scaling.  Make it do so.
    
    While at it, move the definition and initialization of the
    turbo_max local variable to the code branch using it.
    
    No intentional functional impact.
    
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: default avatarChen Yu <yu.c.chen@intel.com>
    b989bc0f
    cpufreq: intel_pstate: Simplify intel_pstate_update_perf_limits()
    Rafael J. Wysocki authored
    
    
    Because pstate.max_freq is always equal to the product of
    pstate.max_pstate and pstate.scaling and, analogously,
    pstate.turbo_freq is always equal to the product of
    pstate.turbo_pstate and pstate.scaling, the result of the
    max_policy_perf computation in intel_pstate_update_perf_limits() is
    always equal to the quotient of policy_max and pstate.scaling,
    regardless of whether or not turbo is disabled.  Analogously, the
    result of min_policy_perf in intel_pstate_update_perf_limits() is
    always equal to the quotient of policy_min and pstate.scaling.
    
    Accordingly, intel_pstate_update_perf_limits() need not check
    whether or not turbo is enabled at all and in order to compute
    max_policy_perf and min_policy_perf it can always divide policy_max
    and policy_min, respectively, by pstate.scaling.  Make it do so.
    
    While at it, move the definition and initialization of the
    turbo_max local variable to the code branch using it.
    
    No intentional functional impact.
    
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Tested-by: default avatarChen Yu <yu.c.chen@intel.com>
Loading