diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-01-30 06:42:37 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-02-08 10:21:39 +0100 |
commit | ffd81dcfef85a33729f90e4acd2f61a68e56b993 (patch) | |
tree | 4160debd7778d436e027edf810e438266953dc11 /drivers/staging/irda | |
parent | 70f6bf2a3b7e40c3f802b0ea837762a8bc6c1430 (diff) | |
download | linux-ffd81dcfef85a33729f90e4acd2f61a68e56b993.tar.gz linux-ffd81dcfef85a33729f90e4acd2f61a68e56b993.tar.bz2 linux-ffd81dcfef85a33729f90e4acd2f61a68e56b993.zip |
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>
Diffstat (limited to 'drivers/staging/irda')
-rw-r--r-- | drivers/staging/irda/drivers/sh_sir.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/irda/drivers/sh_sir.c b/drivers/staging/irda/drivers/sh_sir.c index fede6864c737..0d0687cc454a 100644 --- a/drivers/staging/irda/drivers/sh_sir.c +++ b/drivers/staging/irda/drivers/sh_sir.c @@ -226,7 +226,7 @@ static u32 sh_sir_find_sclk(struct clk *irda_clk) clk_put(pclk); /* IrDA can not set over peripheral_clk */ - cpufreq_for_each_valid_entry(pos, freq_table) { + cpufreq_for_each_valid_entry_idx(pos, freq_table, index) { u32 freq = pos->frequency; /* IrDA should not over peripheral_clk */ @@ -236,7 +236,7 @@ static u32 sh_sir_find_sclk(struct clk *irda_clk) tmp = freq % SCLK_BASE; if (tmp < min) { min = tmp; - index = pos - freq_table; + break; } } |