aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-10-03 10:57:55 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-10-15 18:50:23 -0400
commit184345129c53e76069c209f9912ed7c457eceb31 (patch)
treeaac6a1142dce29a1c622c69fcca0b4da05e31b2d /drivers/cpufreq
parentbe49e3465f222b4b796be8a21d14afbfd8f5d20f (diff)
cpufreq: define generic .attr, .exit() and .verify() routines
Most of the CPUFreq drivers do similar things in .exit() and .verify() routines and .attr. So its better if we have generic routines for them which can be used by cpufreq drivers then. This patch introduces generic .attr, .exit() and .verify() cpufreq drivers. 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')
-rw-r--r--drivers/cpufreq/freq_table.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index b9336edb9bd6..3458d27f63b4 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -86,6 +86,20 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
86} 86}
87EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify); 87EXPORT_SYMBOL_GPL(cpufreq_frequency_table_verify);
88 88
89/*
90 * Generic routine to verify policy & frequency table, requires driver to call
91 * cpufreq_frequency_table_get_attr() prior to it.
92 */
93int cpufreq_generic_frequency_table_verify(struct cpufreq_policy *policy)
94{
95 struct cpufreq_frequency_table *table =
96 cpufreq_frequency_get_table(policy->cpu);
97 if (!table)
98 return -ENODEV;
99
100 return cpufreq_frequency_table_verify(policy, table);
101}
102EXPORT_SYMBOL_GPL(cpufreq_generic_frequency_table_verify);
89 103
90int cpufreq_frequency_table_target(struct cpufreq_policy *policy, 104int cpufreq_frequency_table_target(struct cpufreq_policy *policy,
91 struct cpufreq_frequency_table *table, 105 struct cpufreq_frequency_table *table,
@@ -199,6 +213,12 @@ struct freq_attr cpufreq_freq_attr_scaling_available_freqs = {
199}; 213};
200EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs); 214EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs);
201 215
216struct freq_attr *cpufreq_generic_attr[] = {
217 &cpufreq_freq_attr_scaling_available_freqs,
218 NULL,
219};
220EXPORT_SYMBOL_GPL(cpufreq_generic_attr);
221
202/* 222/*
203 * if you use these, you must assure that the frequency table is valid 223 * if you use these, you must assure that the frequency table is valid
204 * all the time between get_attr and put_attr! 224 * all the time between get_attr and put_attr!