From: Aurelien Jarno Date: Sat, 11 Jul 2020 12:16:51 +0200 Subject: Revert "mips: Add udelay lpj numbers adjustment" Forwarded: no This reverts commit 240934c2d4646fc4ba4423014f6f42ca864acecd. It does not even build with CONFIG_CPU_FREQ=y as the 'policy' member has been added in kernel 5.2. --- arch/mips/kernel/time.c | 70 ----------------------------------------- 1 file changed, 70 deletions(-) diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index 1e631a484ddf..bfe02ded25d1 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c @@ -22,82 +22,12 @@ #include #include #include -#include -#include #include #include #include #include -#ifdef CONFIG_CPU_FREQ - -static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref); -static DEFINE_PER_CPU(unsigned long, pcp_lpj_ref_freq); -static unsigned long glb_lpj_ref; -static unsigned long glb_lpj_ref_freq; - -static int cpufreq_callback(struct notifier_block *nb, - unsigned long val, void *data) -{ - struct cpufreq_freqs *freq = data; - struct cpumask *cpus = freq->policy->cpus; - unsigned long lpj; - int cpu; - - /* - * Skip lpj numbers adjustment if the CPU-freq transition is safe for - * the loops delay. (Is this possible?) - */ - if (freq->flags & CPUFREQ_CONST_LOOPS) - return NOTIFY_OK; - - /* Save the initial values of the lpjes for future scaling. */ - if (!glb_lpj_ref) { - glb_lpj_ref = boot_cpu_data.udelay_val; - glb_lpj_ref_freq = freq->old; - - for_each_online_cpu(cpu) { - per_cpu(pcp_lpj_ref, cpu) = - cpu_data[cpu].udelay_val; - per_cpu(pcp_lpj_ref_freq, cpu) = freq->old; - } - } - - /* - * Adjust global lpj variable and per-CPU udelay_val number in - * accordance with the new CPU frequency. - */ - if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) || - (val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) { - loops_per_jiffy = cpufreq_scale(glb_lpj_ref, - glb_lpj_ref_freq, - freq->new); - - for_each_cpu(cpu, cpus) { - lpj = cpufreq_scale(per_cpu(pcp_lpj_ref, cpu), - per_cpu(pcp_lpj_ref_freq, cpu), - freq->new); - cpu_data[cpu].udelay_val = (unsigned int)lpj; - } - } - - return NOTIFY_OK; -} - -static struct notifier_block cpufreq_notifier = { - .notifier_call = cpufreq_callback, -}; - -static int __init register_cpufreq_notifier(void) -{ - return cpufreq_register_notifier(&cpufreq_notifier, - CPUFREQ_TRANSITION_NOTIFIER); -} -core_initcall(register_cpufreq_notifier); - -#endif /* CONFIG_CPU_FREQ */ - /* * forward reference */ -- 2.27.0