mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 00:22:00 +02:00
cpufreq: Use __free() for policy reference counting cleanup
Use __free() for policy reference counting cleanup where applicable in the cpufreq core. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Acked-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Link: https://patch.msgid.link/9437968.CDJkKcVGEf@rjwysocki.net
This commit is contained in:
parent
c7282dce25
commit
ece898da38
|
|
@ -1818,27 +1818,26 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, b
|
|||
*/
|
||||
unsigned int cpufreq_quick_get(unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *policy;
|
||||
unsigned int ret_freq = 0;
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL;
|
||||
unsigned long flags;
|
||||
|
||||
read_lock_irqsave(&cpufreq_driver_lock, flags);
|
||||
|
||||
if (cpufreq_driver && cpufreq_driver->setpolicy && cpufreq_driver->get) {
|
||||
ret_freq = cpufreq_driver->get(cpu);
|
||||
unsigned int ret_freq = cpufreq_driver->get(cpu);
|
||||
|
||||
read_unlock_irqrestore(&cpufreq_driver_lock, flags);
|
||||
|
||||
return ret_freq;
|
||||
}
|
||||
|
||||
read_unlock_irqrestore(&cpufreq_driver_lock, flags);
|
||||
|
||||
policy = cpufreq_cpu_get(cpu);
|
||||
if (policy) {
|
||||
ret_freq = policy->cur;
|
||||
cpufreq_cpu_put(policy);
|
||||
}
|
||||
if (policy)
|
||||
return policy->cur;
|
||||
|
||||
return ret_freq;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cpufreq_quick_get);
|
||||
|
||||
|
|
@ -1850,15 +1849,13 @@ EXPORT_SYMBOL(cpufreq_quick_get);
|
|||
*/
|
||||
unsigned int cpufreq_quick_get_max(unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
|
||||
unsigned int ret_freq = 0;
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy);
|
||||
|
||||
if (policy) {
|
||||
ret_freq = policy->max;
|
||||
cpufreq_cpu_put(policy);
|
||||
}
|
||||
policy = cpufreq_cpu_get(cpu);
|
||||
if (policy)
|
||||
return policy->max;
|
||||
|
||||
return ret_freq;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cpufreq_quick_get_max);
|
||||
|
||||
|
|
@ -1870,15 +1867,13 @@ EXPORT_SYMBOL(cpufreq_quick_get_max);
|
|||
*/
|
||||
__weak unsigned int cpufreq_get_hw_max_freq(unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
|
||||
unsigned int ret_freq = 0;
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy);
|
||||
|
||||
if (policy) {
|
||||
ret_freq = policy->cpuinfo.max_freq;
|
||||
cpufreq_cpu_put(policy);
|
||||
}
|
||||
policy = cpufreq_cpu_get(cpu);
|
||||
if (policy)
|
||||
return policy->cpuinfo.max_freq;
|
||||
|
||||
return ret_freq;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cpufreq_get_hw_max_freq);
|
||||
|
||||
|
|
@ -1898,20 +1893,18 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
|
|||
*/
|
||||
unsigned int cpufreq_get(unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
|
||||
unsigned int ret_freq = 0;
|
||||
struct cpufreq_policy *policy __free(put_cpufreq_policy);
|
||||
|
||||
policy = cpufreq_cpu_get(cpu);
|
||||
if (!policy)
|
||||
return 0;
|
||||
|
||||
scoped_guard(cpufreq_policy_read, policy) {
|
||||
if (cpufreq_driver->get)
|
||||
ret_freq = __cpufreq_get(policy);
|
||||
}
|
||||
guard(cpufreq_policy_read)(policy);
|
||||
|
||||
cpufreq_cpu_put(policy);
|
||||
if (cpufreq_driver->get)
|
||||
return __cpufreq_get(policy);
|
||||
|
||||
return ret_freq;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cpufreq_get);
|
||||
|
||||
|
|
@ -2566,7 +2559,8 @@ EXPORT_SYMBOL_GPL(cpufreq_unregister_governor);
|
|||
*/
|
||||
int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
|
||||
{
|
||||
struct cpufreq_policy *cpu_policy;
|
||||
struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
|
||||
|
||||
if (!policy)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -2576,7 +2570,6 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu)
|
|||
|
||||
memcpy(policy, cpu_policy, sizeof(*policy));
|
||||
|
||||
cpufreq_cpu_put(cpu_policy);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(cpufreq_get_policy);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user