cpufreq: Add and use cpufreq_for_each_{valid_,}entry_idx()
Pointer subtraction is slow and tedious. Therefore, replace all instances where cpufreq_for_each_{valid_,}entry loops contained such substractions with an iteration macro providing an index to the frequency_table entry. Suggested-by: Al Viro <viro@ZenIV.linux.org.uk> Link: http://lkml.kernel.org/r/20180120020237.GM13338@ZenIV.linux.org.uk Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
70f6bf2a3b
commit
ffd81dcfef
@@ -291,3 +291,7 @@ For example:
|
||||
/* Do something with pos */
|
||||
pos->frequency = ...
|
||||
}
|
||||
|
||||
If you need to work with the position of pos within driver_freq_table,
|
||||
do not subtract the pointers, as it is quite costly. Instead, use the
|
||||
macros cpufreq_for_each_entry_idx() and cpufreq_for_each_valid_entry_idx().
|
||||
|
Reference in New Issue
Block a user