aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2015-01-02 02:04:28 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-01-23 16:49:34 -0500
commita1e1dc41c4efb41e1e402a6b5a45b75687030664 (patch)
treea917ef9aedce304fa1302b5448b40ff0bada6f61 /drivers/cpufreq/cpufreq.c
parent2e1cc3a5d7efa42d3aa4aaa77b9b2c3a51bb6073 (diff)
cpufreq: pass policy to cpufreq_out_of_sync
There is no point finding out the 'policy' again within cpufreq_out_of_sync() when all the callers already have it. Just make them pass policy instead. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 1454ab3f0023..0a9e764a6e2d 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1509,30 +1509,23 @@ static void handle_update(struct work_struct *work)
1509/** 1509/**
1510 * cpufreq_out_of_sync - If actual and saved CPU frequency differs, we're 1510 * cpufreq_out_of_sync - If actual and saved CPU frequency differs, we're
1511 * in deep trouble. 1511 * in deep trouble.
1512 * @cpu: cpu number 1512 * @policy: policy managing CPUs
1513 * @old_freq: CPU frequency the kernel thinks the CPU runs at
1514 * @new_freq: CPU frequency the CPU actually runs at 1513 * @new_freq: CPU frequency the CPU actually runs at
1515 * 1514 *
1516 * We adjust to current frequency first, and need to clean up later. 1515 * We adjust to current frequency first, and need to clean up later.
1517 * So either call to cpufreq_update_policy() or schedule handle_update()). 1516 * So either call to cpufreq_update_policy() or schedule handle_update()).
1518 */ 1517 */
1519static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, 1518static void cpufreq_out_of_sync(struct cpufreq_policy *policy,
1520 unsigned int new_freq) 1519 unsigned int new_freq)
1521{ 1520{
1522 struct cpufreq_policy *policy;
1523 struct cpufreq_freqs freqs; 1521 struct cpufreq_freqs freqs;
1524 unsigned long flags;
1525 1522
1526 pr_debug("Warning: CPU frequency out of sync: cpufreq and timing core thinks of %u, is %u kHz\n", 1523 pr_debug("Warning: CPU frequency out of sync: cpufreq and timing core thinks of %u, is %u kHz\n",
1527 old_freq, new_freq); 1524 policy->cur, new_freq);
1528 1525
1529 freqs.old = old_freq; 1526 freqs.old = policy->cur;
1530 freqs.new = new_freq; 1527 freqs.new = new_freq;
1531 1528
1532 read_lock_irqsave(&cpufreq_driver_lock, flags);
1533 policy = per_cpu(cpufreq_cpu_data, cpu);
1534 read_unlock_irqrestore(&cpufreq_driver_lock, flags);
1535
1536 cpufreq_freq_transition_begin(policy, &freqs); 1529 cpufreq_freq_transition_begin(policy, &freqs);
1537 cpufreq_freq_transition_end(policy, &freqs, 0); 1530 cpufreq_freq_transition_end(policy, &freqs, 0);
1538} 1531}
@@ -1597,7 +1590,7 @@ static unsigned int __cpufreq_get(unsigned int cpu)
1597 /* verify no discrepancy between actual and 1590 /* verify no discrepancy between actual and
1598 saved value exists */ 1591 saved value exists */
1599 if (unlikely(ret_freq != policy->cur)) { 1592 if (unlikely(ret_freq != policy->cur)) {
1600 cpufreq_out_of_sync(cpu, policy->cur, ret_freq); 1593 cpufreq_out_of_sync(policy, ret_freq);
1601 schedule_work(&policy->update); 1594 schedule_work(&policy->update);
1602 } 1595 }
1603 } 1596 }
@@ -2302,8 +2295,7 @@ int cpufreq_update_policy(unsigned int cpu)
2302 policy->cur = new_policy.cur; 2295 policy->cur = new_policy.cur;
2303 } else { 2296 } else {
2304 if (policy->cur != new_policy.cur && has_target()) 2297 if (policy->cur != new_policy.cur && has_target())
2305 cpufreq_out_of_sync(cpu, policy->cur, 2298 cpufreq_out_of_sync(policy, new_policy.cur);
2306 new_policy.cur);
2307 } 2299 }
2308 } 2300 }
2309 2301