diff options
Diffstat (limited to 'drivers/cpufreq/freq_table.c')
-rw-r--r-- | drivers/cpufreq/freq_table.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c index 3458d27f63b4..a8ac0427fbfe 100644 --- a/drivers/cpufreq/freq_table.c +++ b/drivers/cpufreq/freq_table.c | |||
@@ -178,7 +178,29 @@ int cpufreq_frequency_table_target(struct cpufreq_policy *policy, | |||
178 | } | 178 | } |
179 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); | 179 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_target); |
180 | 180 | ||
181 | int cpufreq_frequency_table_get_index(struct cpufreq_policy *policy, | ||
182 | unsigned int freq) | ||
183 | { | ||
184 | struct cpufreq_frequency_table *table; | ||
185 | int i; | ||
186 | |||
187 | table = cpufreq_frequency_get_table(policy->cpu); | ||
188 | if (unlikely(!table)) { | ||
189 | pr_debug("%s: Unable to find frequency table\n", __func__); | ||
190 | return -ENOENT; | ||
191 | } | ||
192 | |||
193 | for (i = 0; table[i].frequency != CPUFREQ_TABLE_END; i++) { | ||
194 | if (table[i].frequency == freq) | ||
195 | return i; | ||
196 | } | ||
197 | |||
198 | return -EINVAL; | ||
199 | } | ||
200 | EXPORT_SYMBOL_GPL(cpufreq_frequency_table_get_index); | ||
201 | |||
181 | static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); | 202 | static DEFINE_PER_CPU(struct cpufreq_frequency_table *, cpufreq_show_table); |
203 | |||
182 | /** | 204 | /** |
183 | * show_available_freqs - show available frequencies for the specified CPU | 205 | * show_available_freqs - show available frequencies for the specified CPU |
184 | */ | 206 | */ |