aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/freq_table.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-03-30 06:55:15 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-04 08:25:59 -0400
commit5070158804b5339c71809f5e673cea1cfacd804d (patch)
tree42256e81e326af4e568a179787e66d434a0b1ffc /drivers/cpufreq/freq_table.c
parent2361be23666232dbb4851a527f466c4cbf5340fc (diff)
cpufreq: rename index as driver_data in cpufreq_frequency_table
The "index" field of struct cpufreq_frequency_table was never an index and isn't used at all by the cpufreq core. It only is useful for cpufreq drivers for their internal purposes. Many people nowadays blindly set it in ascending order with the assumption that the core will use it, which is a mistake. Rename it to "driver_data" as that's what its purpose is. All of its users are updated accordingly. [rjw: Changelog] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/freq_table.c')
-rw-r--r--drivers/cpufreq/freq_table.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index d7a79662e24c..f0d87412cc91 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -34,8 +34,8 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
34 34
35 continue; 35 continue;
36 } 36 }
37 pr_debug("table entry %u: %u kHz, %u index\n", 37 pr_debug("table entry %u: %u kHz, %u driver_data\n",
38 i, freq, table[i].index); 38 i, freq, table[i].driver_data);
39 if (freq < min_freq) 39 if (freq < min_freq)
40 min_freq = freq; 40 min_freq = freq;
41 if (freq > max_freq) 41 if (freq > max_freq)
@@ -97,11 +97,11 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
97 unsigned int *index) 97 unsigned int *index)
98{ 98{
99 struct cpufreq_frequency_table optimal = { 99 struct cpufreq_frequency_table optimal = {
100 .index = ~0, 100 .driver_data = ~0,
101 .frequency = 0, 101 .frequency = 0,
102 }; 102 };
103 struct cpufreq_frequency_table suboptimal = { 103 struct cpufreq_frequency_table suboptimal = {
104 .index = ~0, 104 .driver_data = ~0,
105 .frequency = 0, 105 .frequency = 0,
106 }; 106 };
107 unsigned int i; 107 unsigned int i;
@@ -129,12 +129,12 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
129 if (freq <= target_freq) { 129 if (freq <= target_freq) {
130 if (freq >= optimal.frequency) { 130 if (freq >= optimal.frequency) {
131 optimal.frequency = freq; 131 optimal.frequency = freq;
132 optimal.index = i; 132 optimal.driver_data = i;
133 } 133 }
134 } else { 134 } else {
135 if (freq <= suboptimal.frequency) { 135 if (freq <= suboptimal.frequency) {
136 suboptimal.frequency = freq; 136 suboptimal.frequency = freq;
137 suboptimal.index = i; 137 suboptimal.driver_data = i;
138 } 138 }
139 } 139 }
140 break; 140 break;
@@ -142,26 +142,26 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
142 if (freq >= target_freq) { 142 if (freq >= target_freq) {
143 if (freq <= optimal.frequency) { 143 if (freq <= optimal.frequency) {
144 optimal.frequency = freq; 144 optimal.frequency = freq;
145 optimal.index = i; 145 optimal.driver_data = i;
146 } 146 }
147 } else { 147 } else {
148 if (freq >= suboptimal.frequency) { 148 if (freq >= suboptimal.frequency) {
149 suboptimal.frequency = freq; 149 suboptimal.frequency = freq;
150 suboptimal.index = i; 150 suboptimal.driver_data = i;
151 } 151 }
152 } 152 }
153 break; 153 break;
154 } 154 }
155 } 155 }
156 if (optimal.index > i) { 156 if (optimal.driver_data > i) {
157 if (suboptimal.index > i) 157 if (suboptimal.driver_data > i)
158 return -EINVAL; 158 return -EINVAL;
159 *index = suboptimal.index; 159 *index = suboptimal.driver_data;
160 } else 160 } else
161 *index = optimal.index; 161 *index = optimal.driver_data;
162 162
163 pr_debug("target is %u (%u kHz, %u)\n", *index, table[*index].frequency, 163 pr_debug("target is %u (%u kHz, %u)\n", *index, table[*index].frequency,
164 table[*index].index); 164 table[*index].driver_data);
165 165
166 return 0; 166 return 0;
167} 167}