Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

cpufreq: Add new helper function returning cpufreq policy

cpufreq_cpu_get_raw() gets cpufreq policy only if the CPU is in
policy->cpus mask, which means the CPU is already online. But in some
cases, the policy is needed before the CPU is added to cpus mask. Add a
function to get the policy in these cases.

Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
Reviewed-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com>
Acked-by: Beata Michalska <beata.michalska@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Lifeng Zheng and committed by
Will Deacon
4221504c af15bc25

+11
+6
drivers/cpufreq/cpufreq.c
··· 198 198 } 199 199 EXPORT_SYMBOL_GPL(cpufreq_cpu_get_raw); 200 200 201 + struct cpufreq_policy *cpufreq_cpu_policy(unsigned int cpu) 202 + { 203 + return per_cpu(cpufreq_cpu_data, cpu); 204 + } 205 + EXPORT_SYMBOL_GPL(cpufreq_cpu_policy); 206 + 201 207 unsigned int cpufreq_generic_get(unsigned int cpu) 202 208 { 203 209 struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
+5
include/linux/cpufreq.h
··· 203 203 204 204 #ifdef CONFIG_CPU_FREQ 205 205 struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu); 206 + struct cpufreq_policy *cpufreq_cpu_policy(unsigned int cpu); 206 207 struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu); 207 208 void cpufreq_cpu_put(struct cpufreq_policy *policy); 208 209 #else 209 210 static inline struct cpufreq_policy *cpufreq_cpu_get_raw(unsigned int cpu) 211 + { 212 + return NULL; 213 + } 214 + static inline struct cpufreq_policy *cpufreq_cpu_policy(unsigned int cpu) 210 215 { 211 216 return NULL; 212 217 }