Commit 5c3c2ea6 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Ingo Molnar

x86/tsc: Fold set_cyc2ns_scale() into caller

The newly introduced wrapper function only has one caller,
and this one is conditional, causing a harmless warning when
CONFIG_CPU_FREQ is disabled:

  arch/x86/kernel/tsc.c:189:13: error: 'set_cyc2ns_scale' defined but not used [-Werror=unused-function]

My first idea was to move the wrapper inside of that #ifdef,
but on second thought it seemed nicer to remove it completely
again and rename __set_cyc2ns_scale back to set_cyc2ns_scale,
but leaving the extra argument.
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarPeter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 615cd033 ("x86/tsc: Fix sched_clock() sync")
Link: http://lkml.kernel.org/r/20170517203949.2052220-1-arnd@arndb.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 1c3c5eab
...@@ -137,7 +137,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc) ...@@ -137,7 +137,7 @@ static inline unsigned long long cycles_2_ns(unsigned long long cyc)
return ns; return ns;
} }
static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now) static void set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long tsc_now)
{ {
unsigned long long ns_now; unsigned long long ns_now;
struct cyc2ns_data data; struct cyc2ns_data data;
...@@ -186,11 +186,6 @@ static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long ts ...@@ -186,11 +186,6 @@ static void __set_cyc2ns_scale(unsigned long khz, int cpu, unsigned long long ts
local_irq_restore(flags); local_irq_restore(flags);
} }
static void set_cyc2ns_scale(unsigned long khz, int cpu)
{
__set_cyc2ns_scale(khz, cpu, rdtsc());
}
/* /*
* Scheduler clock - returns current time in nanosec units. * Scheduler clock - returns current time in nanosec units.
*/ */
...@@ -892,7 +887,6 @@ void tsc_restore_sched_clock_state(void) ...@@ -892,7 +887,6 @@ void tsc_restore_sched_clock_state(void)
} }
#ifdef CONFIG_CPU_FREQ #ifdef CONFIG_CPU_FREQ
/* Frequency scaling support. Adjust the TSC based timer when the cpu frequency /* Frequency scaling support. Adjust the TSC based timer when the cpu frequency
* changes. * changes.
* *
...@@ -933,7 +927,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, ...@@ -933,7 +927,7 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
if (!(freq->flags & CPUFREQ_CONST_LOOPS)) if (!(freq->flags & CPUFREQ_CONST_LOOPS))
mark_tsc_unstable("cpufreq changes"); mark_tsc_unstable("cpufreq changes");
set_cyc2ns_scale(tsc_khz, freq->cpu); set_cyc2ns_scale(tsc_khz, freq->cpu, rdtsc());
} }
return 0; return 0;
...@@ -1224,7 +1218,7 @@ static void tsc_refine_calibration_work(struct work_struct *work) ...@@ -1224,7 +1218,7 @@ static void tsc_refine_calibration_work(struct work_struct *work)
/* Update the sched_clock() rate to match the clocksource one */ /* Update the sched_clock() rate to match the clocksource one */
for_each_possible_cpu(cpu) for_each_possible_cpu(cpu)
__set_cyc2ns_scale(tsc_khz, cpu, tsc_stop); set_cyc2ns_scale(tsc_khz, cpu, tsc_stop);
out: out:
if (boot_cpu_has(X86_FEATURE_ART)) if (boot_cpu_has(X86_FEATURE_ART))
...@@ -1314,7 +1308,7 @@ void __init tsc_init(void) ...@@ -1314,7 +1308,7 @@ void __init tsc_init(void)
cyc = rdtsc(); cyc = rdtsc();
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
cyc2ns_init(cpu); cyc2ns_init(cpu);
__set_cyc2ns_scale(tsc_khz, cpu, cyc); set_cyc2ns_scale(tsc_khz, cpu, cyc);
} }
if (tsc_disabled > 0) if (tsc_disabled > 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment