aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-06-03 01:28:50 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-06-08 18:58:06 -0400
commit2372784542cb7a8b256a740840abf4503de0d669 (patch)
tree1c4322ba02029661580a324b23c4271afbccb2b7
parent7ab4aabbaa98fbf9f8967fd93162d675439337e1 (diff)
cpufreq: Drop 'freq_table' argument of __target_index()
It is already present as part of the policy and so no need to pass it from the caller. Also, 'freq_table' is guaranteed to be valid in this function and so no need to check it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index a28144697128..1685e930770f 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1852,14 +1852,17 @@ static int __target_intermediate(struct cpufreq_policy *policy,
1852 return ret; 1852 return ret;
1853} 1853}
1854 1854
1855static int __target_index(struct cpufreq_policy *policy, 1855static int __target_index(struct cpufreq_policy *policy, int index)
1856 struct cpufreq_frequency_table *freq_table, int index)
1857{ 1856{
1858 struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0}; 1857 struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0};
1859 unsigned int intermediate_freq = 0; 1858 unsigned int intermediate_freq = 0;
1859 unsigned int newfreq = policy->freq_table[index].frequency;
1860 int retval = -EINVAL; 1860 int retval = -EINVAL;
1861 bool notify; 1861 bool notify;
1862 1862
1863 if (newfreq == policy->cur)
1864 return 0;
1865
1863 notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION); 1866 notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION);
1864 if (notify) { 1867 if (notify) {
1865 /* Handle switching to intermediate frequency */ 1868 /* Handle switching to intermediate frequency */
@@ -1874,7 +1877,7 @@ static int __target_index(struct cpufreq_policy *policy,
1874 freqs.old = freqs.new; 1877 freqs.old = freqs.new;
1875 } 1878 }
1876 1879
1877 freqs.new = freq_table[index].frequency; 1880 freqs.new = newfreq;
1878 pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n", 1881 pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n",
1879 __func__, policy->cpu, freqs.old, freqs.new); 1882 __func__, policy->cpu, freqs.old, freqs.new);
1880 1883
@@ -1911,7 +1914,6 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
1911 unsigned int relation) 1914 unsigned int relation)
1912{ 1915{
1913 unsigned int old_target_freq = target_freq; 1916 unsigned int old_target_freq = target_freq;
1914 struct cpufreq_frequency_table *freq_table;
1915 int index, retval; 1917 int index, retval;
1916 1918
1917 if (cpufreq_disabled()) 1919 if (cpufreq_disabled())
@@ -1941,12 +1943,6 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
1941 if (!cpufreq_driver->target_index) 1943 if (!cpufreq_driver->target_index)
1942 return -EINVAL; 1944 return -EINVAL;
1943 1945
1944 freq_table = policy->freq_table;
1945 if (unlikely(!freq_table)) {
1946 pr_err("%s: Unable to find freq_table\n", __func__);
1947 return -EINVAL;
1948 }
1949
1950 retval = cpufreq_frequency_table_target(policy, target_freq, relation, 1946 retval = cpufreq_frequency_table_target(policy, target_freq, relation,
1951 &index); 1947 &index);
1952 if (unlikely(retval)) { 1948 if (unlikely(retval)) {
@@ -1954,10 +1950,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
1954 return retval; 1950 return retval;
1955 } 1951 }
1956 1952
1957 if (freq_table[index].frequency == policy->cur) 1953 return __target_index(policy, index);
1958 return 0;
1959
1960 return __target_index(policy, freq_table, index);
1961} 1954}
1962EXPORT_SYMBOL_GPL(__cpufreq_driver_target); 1955EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
1963 1956