ARM/arm64: vdso: Use common vdso clock mode storage
[linux-2.6-microblaze.git] / arch / arm / include / asm / vdso / gettimeofday.h
index f4757d3..07d791c 100644 (file)
@@ -117,15 +117,21 @@ static __always_inline u64 __arch_get_hw_counter(int clock_mode)
 #ifdef CONFIG_ARM_ARCH_TIMER
        u64 cycle_now;
 
-       if (!clock_mode)
-               return -EINVAL;
+       /*
+        * Core checks for mode already, so this raced against a concurrent
+        * update. Return something. Core will do another round and then
+        * see the mode change and fallback to the syscall.
+        */
+       if (clock_mode == VDSO_CLOCKMODE_NONE)
+               return 0;
 
        isb();
        cycle_now = read_sysreg(CNTVCT);
 
        return cycle_now;
 #else
-       return -EINVAL; /* use fallback */
+       /* Make GCC happy. This is compiled out anyway */
+       return 0;
 #endif
 }