Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: ppc-corenet-cpu-freq: do_div use quotient

Commit 6712d2931933 (cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost
error) used the remainder from do_div instead of the quotient. Fix that
and add one to ensure minimum is met.

Fixes: 6712d2931933 (cpufreq: ppc-corenet-cpufreq: Fix __udivdi3 modpost error)
Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
Cc: 3.15+ <stable@vger.kernel.org> # 3.15+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Ed Swarthout and committed by
Rafael J. Wysocki
906fe033 57aa5ea0

+5 -4
+5 -4
drivers/cpufreq/ppc-corenet-cpufreq.c
··· 138 138 struct cpufreq_frequency_table *table; 139 139 struct cpu_data *data; 140 140 unsigned int cpu = policy->cpu; 141 - u64 transition_latency_hz; 141 + u64 u64temp; 142 142 143 143 np = of_get_cpu_node(cpu, NULL); 144 144 if (!np) ··· 206 206 for_each_cpu(i, per_cpu(cpu_mask, cpu)) 207 207 per_cpu(cpu_data, i) = data; 208 208 209 - transition_latency_hz = 12ULL * NSEC_PER_SEC; 210 - policy->cpuinfo.transition_latency = 211 - do_div(transition_latency_hz, fsl_get_sys_freq()); 209 + /* Minimum transition latency is 12 platform clocks */ 210 + u64temp = 12ULL * NSEC_PER_SEC; 211 + do_div(u64temp, fsl_get_sys_freq()); 212 + policy->cpuinfo.transition_latency = u64temp + 1; 212 213 213 214 of_node_put(np); 214 215