diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2020-02-07 13:38:57 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2020-02-17 20:12:16 +0100 |
commit | e1bdb22ebe5363ed75ddedf836ca9f19e1195337 (patch) | |
tree | 0ff39b2bb1d92f6f8c045f6dc0299f6b3b155651 /arch/mips/include/asm/vdso/gettimeofday.h | |
parent | b95a8a27c300d1a39a4e36f63a518ef36e4b966c (diff) | |
download | linux-stable-e1bdb22ebe5363ed75ddedf836ca9f19e1195337.tar.gz linux-stable-e1bdb22ebe5363ed75ddedf836ca9f19e1195337.tar.bz2 linux-stable-e1bdb22ebe5363ed75ddedf836ca9f19e1195337.zip |
mips: vdso: Use generic VDSO clock mode storage
Switch to the generic VDSO clock mode storage.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
Link: https://lkml.kernel.org/r/20200207124403.244684017@linutronix.de
Diffstat (limited to 'arch/mips/include/asm/vdso/gettimeofday.h')
-rw-r--r-- | arch/mips/include/asm/vdso/gettimeofday.h | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/arch/mips/include/asm/vdso/gettimeofday.h b/arch/mips/include/asm/vdso/gettimeofday.h index a9f846b1a920..88c3de1bdf22 100644 --- a/arch/mips/include/asm/vdso/gettimeofday.h +++ b/arch/mips/include/asm/vdso/gettimeofday.h @@ -24,8 +24,6 @@ #define VDSO_HAS_CLOCK_GETRES 1 -#define __VDSO_USE_SYSCALL ULLONG_MAX - static __always_inline long gettimeofday_fallback( struct __kernel_old_timeval *_tv, struct timezone *_tz) @@ -175,28 +173,20 @@ static __always_inline u64 read_gic_count(const struct vdso_data *data) static __always_inline u64 __arch_get_hw_counter(s32 clock_mode) { -#ifdef CONFIG_CLKSRC_MIPS_GIC - const struct vdso_data *data = get_vdso_data(); -#endif - u64 cycle_now; - - switch (clock_mode) { #ifdef CONFIG_CSRC_R4K - case VDSO_CLOCK_R4K: - cycle_now = read_r4k_count(); - break; + if (clock_mode == VDSO_CLOCKMODE_R4K) + return read_r4k_count(); #endif #ifdef CONFIG_CLKSRC_MIPS_GIC - case VDSO_CLOCK_GIC: - cycle_now = read_gic_count(data); - break; + if (clock_mode == VDSO_CLOCKMODE_GIC) + return read_gic_count(get_vdso_data()); #endif - default: - cycle_now = __VDSO_USE_SYSCALL; - break; - } - - return cycle_now; + /* + * Core checks mode already. So this raced against a concurrent + * update. Return something. Core will do another round see the + * change and fallback to syscall. + */ + return 0; } static inline bool mips_vdso_hres_capable(void) |