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

cpufreq: remove unnecessary cpufreq_cpu_{get|put}() calls

struct cpufreq_policy is already passed as argument to some routines
like: __cpufreq_driver_getavg() and so we don't really need to do
cpufreq_cpu_get() before and cpufreq_cpu_put() in them to get a
policy structure.

Remove them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Viresh Kumar and committed by
Rafael J. Wysocki
a262e94c 27209d91

+2 -17
+2 -17
drivers/cpufreq/cpufreq.c
··· 1572 1572 { 1573 1573 int ret = -EINVAL; 1574 1574 1575 - policy = cpufreq_cpu_get(policy->cpu); 1576 - if (!policy) 1577 - goto no_policy; 1578 - 1579 1575 if (unlikely(lock_policy_rwsem_write(policy->cpu))) 1580 1576 goto fail; 1581 1577 ··· 1580 1584 unlock_policy_rwsem_write(policy->cpu); 1581 1585 1582 1586 fail: 1583 - cpufreq_cpu_put(policy); 1584 - no_policy: 1585 1587 return ret; 1586 1588 } 1587 1589 EXPORT_SYMBOL_GPL(cpufreq_driver_target); 1588 1590 1589 1591 int __cpufreq_driver_getavg(struct cpufreq_policy *policy, unsigned int cpu) 1590 1592 { 1591 - int ret = 0; 1592 - 1593 1593 if (cpufreq_disabled()) 1594 - return ret; 1594 + return 0; 1595 1595 1596 1596 if (!cpufreq_driver->getavg) 1597 1597 return 0; 1598 1598 1599 - policy = cpufreq_cpu_get(policy->cpu); 1600 - if (!policy) 1601 - return -EINVAL; 1602 - 1603 - ret = cpufreq_driver->getavg(policy, cpu); 1604 - 1605 - cpufreq_cpu_put(policy); 1606 - return ret; 1599 + return cpufreq_driver->getavg(policy, cpu); 1607 1600 } 1608 1601 EXPORT_SYMBOL_GPL(__cpufreq_driver_getavg); 1609 1602