• V
    cpufreq: Allow freq_table to be obtained for offline CPUs · 5a31d594
    Viresh Kumar 提交于
    Users of freq table may want to access it for any CPU from
    policy->related_cpus mask. One such user is cpu-cooling layer. It gets a
    list of 'clip_cpus' (equivalent to policy->related_cpus) during
    registration and tries to get freq_table for the first CPU of this mask.
    
    If the CPU, for which it tries to fetch freq_table, is offline,
    cpufreq_frequency_get_table() fails. This happens because it relies on
    cpufreq_cpu_get_raw() for its functioning which returns policy only for
    online CPUs.
    
    The fix is to access the policy data structure for the given CPU
    directly (which also returns a valid policy for offline CPUs), but the
    policy itself has to be active (meaning that at least one CPU using it
    is online) for the frequency table to be returned.
    
    Because we will be using 'cpufreq_cpu_data' now, which is internal to
    the cpufreq core, move cpufreq_frequency_get_table() to cpufreq.c.
    Reported-and-tested-by: NPi-Cheng Chen <pi-cheng.chen@linaro.org>
    Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    5a31d594
cpufreq.c 67.1 KB