kernel/signal.c: fix suboptimal printk usage
[firefly-linux-kernel-4.4.55.git] / kernel / time / timekeeping.c
index 1e35515a875e86966e08a47737c6dfb070956309..9a0bc98fbe1db40208b9025bbfcf51f34057f1dc 100644 (file)
@@ -138,6 +138,20 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
 }
 
 /* Timekeeper helper functions. */
+
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+u32 (*arch_gettimeoffset)(void);
+
+u32 get_arch_timeoffset(void)
+{
+       if (likely(arch_gettimeoffset))
+               return arch_gettimeoffset();
+       return 0;
+}
+#else
+static inline u32 get_arch_timeoffset(void) { return 0; }
+#endif
+
 static inline s64 timekeeping_get_ns(struct timekeeper *tk)
 {
        cycle_t cycle_now, cycle_delta;
@@ -154,8 +168,8 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
        nsec = cycle_delta * tk->mult + tk->xtime_nsec;
        nsec >>= tk->shift;
 
-       /* If arch requires, add in gettimeoffset() */
-       return nsec + arch_gettimeoffset();
+       /* If arch requires, add in get_arch_timeoffset() */
+       return nsec + get_arch_timeoffset();
 }
 
 static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
@@ -174,8 +188,8 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
        /* convert delta to nanoseconds. */
        nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
 
-       /* If arch requires, add in gettimeoffset() */
-       return nsec + arch_gettimeoffset();
+       /* If arch requires, add in get_arch_timeoffset() */
+       return nsec + get_arch_timeoffset();
 }
 
 static RAW_NOTIFIER_HEAD(pvclock_gtod_chain);
@@ -257,8 +271,8 @@ static void timekeeping_forward_now(struct timekeeper *tk)
 
        tk->xtime_nsec += cycle_delta * tk->mult;
 
-       /* If arch requires, add in gettimeoffset() */
-       tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift;
+       /* If arch requires, add in get_arch_timeoffset() */
+       tk->xtime_nsec += (u64)get_arch_timeoffset() << tk->shift;
 
        tk_normalize_xtime(tk);