lkml.org 
[lkml]   [2016]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH v3 1/3] cpufreq: add cpufreq_driver_resolve_freq()
    On Thu, Jul 21, 2016 at 01:30:41PM -0700, Viresh Kumar wrote:
    > Okay, but in that case shouldn't we do something like this:
    >
    > unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
    > unsigned int target_freq)
    > {
    > target_freq = clamp_val(target_freq, policy->min, policy->max);
    > policy->cached_target_freq = target_freq;
    >
    > if (cpufreq_driver->target_index) {
    > policy->cached_resolved_idx =
    > cpufreq_frequency_table_target(policy, target_freq,
    > CPUFREQ_RELATION_L);
    > return policy->freq_table[policy->cached_resolved_idx].frequency;
    > }
    >
    > if (cpufreq_driver->resolve_freq)
    > return cpufreq_driver->resolve_freq(policy, target_freq);
    > }

    Thanks for the review.

    My thinking (noted in the commit text) was that the caller of
    cpufreq_driver_resolve_freq() would verify that the driver supported the
    proper calls before using this API. This way it can be checked once,
    presumably in a governor's init routine. Checking the pointer over and
    over again in a fast path is wasteful.


    \
     
     \ /
      Last update: 2016-07-22 02:01    [W:2.667 / U:0.488 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site