From: Dian Zheng <zhengd@xxxxxxxxxx> Signed-off-by: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> Signed-off-by: Dian Zheng <zhengd@xxxxxxxxxx> --- arch/mips/include/asm/time.h | 3 +++ arch/mips/kernel/csrc-r4k.c | 5 ++--- arch/mips/kernel/time.c | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/mips/include/asm/time.h b/arch/mips/include/asm/time.h index e855a3611d92..e235b8a27768 100644 --- a/arch/mips/include/asm/time.h +++ b/arch/mips/include/asm/time.h @@ -28,6 +28,9 @@ extern void plat_time_init(void); */ extern unsigned int mips_hpt_frequency; +/* True if platform registered sched_clock by itself */ +extern bool plat_have_sched_clock __initdata; + /* * The performance counter IRQ on MIPS is a close relative to the timer IRQ * so it lives here. diff --git a/arch/mips/kernel/csrc-r4k.c b/arch/mips/kernel/csrc-r4k.c index edc4afc080fa..b50a24da6528 100644 --- a/arch/mips/kernel/csrc-r4k.c +++ b/arch/mips/kernel/csrc-r4k.c @@ -122,9 +122,8 @@ int __init init_r4k_clocksource(void) clocksource_register_hz(&clocksource_mips, mips_hpt_frequency); -#ifndef CONFIG_CPU_FREQ - sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency); -#endif + if (!IS_ENABLED(CONFIG_CPU_FREQ) && !plat_have_sched_clock) + sched_clock_register(r4k_read_sched_clock, 32, mips_hpt_frequency); return 0; } diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c index caa01457dce6..baf33da8c79d 100644 --- a/arch/mips/kernel/time.c +++ b/arch/mips/kernel/time.c @@ -123,6 +123,9 @@ EXPORT_SYMBOL(perf_irq); unsigned int mips_hpt_frequency; EXPORT_SYMBOL_GPL(mips_hpt_frequency); +/* True if platform registered sched_clock by itself */ +bool plat_have_sched_clock __initdata; + static __init int cpu_has_mfc0_count_bug(void) { switch (current_cpu_type()) { -- 2.18.1