summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorStratos Karafotis <stratosk@semaphore.gr>2014-04-25 23:15:23 +0300
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>2015-02-04 11:14:31 +0100
commit99ebcfdd67ac6fc18a06d4eac6198d89f70d7229 (patch)
tree719db2e6cedfa031f865ea74e3ac80561ff9ea51 /Documentation
parent71449b64c19a7736d5d694f186f2ea10f144ab48 (diff)
downloadlinux-stable-99ebcfdd67ac6fc18a06d4eac6198d89f70d7229.tar.gz
linux-stable-99ebcfdd67ac6fc18a06d4eac6198d89f70d7229.tar.bz2
linux-stable-99ebcfdd67ac6fc18a06d4eac6198d89f70d7229.zip
cpufreq: Introduce macros for cpufreq_frequency_table iteration
Many cpufreq drivers need to iterate over the cpufreq_frequency_table for various tasks. This patch introduces two macros which can be used for iteration over cpufreq_frequency_table keeping a common coding style across drivers: - cpufreq_for_each_entry: iterate over each entry of the table - cpufreq_for_each_valid_entry: iterate over each entry that contains a valid frequency. It should have no functional changes. Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr> Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> (cherry picked from commit 27e289dce29764e488c1e13e9aa6950cad1f4aab) Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/cpu-freq/cpu-drivers.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/Documentation/cpu-freq/cpu-drivers.txt b/Documentation/cpu-freq/cpu-drivers.txt
index 8b1a4451422e..d3cb4d3d9bb2 100644
--- a/Documentation/cpu-freq/cpu-drivers.txt
+++ b/Documentation/cpu-freq/cpu-drivers.txt
@@ -222,3 +222,22 @@ is the corresponding frequency table helper for the ->target
stage. Just pass the values to this function, and the unsigned int
index returns the number of the frequency table entry which contains
the frequency the CPU shall be set to.
+
+The following macros can be used as iterators over cpufreq_frequency_table:
+
+cpufreq_for_each_entry(pos, table) - iterates over all entries of frequency
+table.
+
+cpufreq-for_each_valid_entry(pos, table) - iterates over all entries,
+excluding CPUFREQ_ENTRY_INVALID frequencies.
+Use arguments "pos" - a cpufreq_frequency_table * as a loop cursor and
+"table" - the cpufreq_frequency_table * you want to iterate over.
+
+For example:
+
+ struct cpufreq_frequency_table *pos, *driver_freq_table;
+
+ cpufreq_for_each_entry(pos, driver_freq_table) {
+ /* Do something with pos */
+ pos->frequency = ...
+ }