• Viresh Kumar's avatar
    cpufreq: Simplify cpufreq_add_dev() · fcf80582
    Viresh Kumar authored
    Currently cpufreq_add_dev() firsts allocates policy, calls
    driver->init() and then checks if this CPU is already managed or not.
    And if it is already managed, its policy is freed.
    
    We can save all this if we somehow know that CPU is managed or not in
    advance.  policy->related_cpus contains the list of all valid sibling
    CPUs of policy->cpu. We can check this to see if the current CPU is
    already managed.
    
    From now on, platforms don't really need to set related_cpus from
    their init() routines, as the same work is done by core too.
    
    If a platform driver needs to set the related_cpus mask with some
    additional CPUs, other than CPUs present in policy->cpus, they are
    free to do it, though, as we don't override anything.
    
    [rjw: Changelog]
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Tested-by: default avatarShawn Guo <shawn.guo@linaro.org>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    fcf80582
cpufreq.c 49.1 KB