Skip to content

Commit

Permalink
timekeeping: Simplify arch_gettimeoffset()
Browse files Browse the repository at this point in the history
Provide a default stub function instead of having the extra
conditional. Cuts binary size on a m68k build by ~100 bytes.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
Thomas Gleixner authored and John Stultz committed Jul 23, 2014
1 parent dc01c9f commit e06fde3
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,10 @@ 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;
}
static u32 default_arch_gettimeoffset(void) { return 0; }
u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset;
#else
static inline u32 get_arch_timeoffset(void) { return 0; }
static inline u32 arch_gettimeoffset(void) { return 0; }
#endif

static inline s64 timekeeping_get_ns(struct timekeeper *tk)
Expand All @@ -182,7 +176,7 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
nsec >>= tk->shift;

/* If arch requires, add in get_arch_timeoffset() */
return nsec + get_arch_timeoffset();
return nsec + arch_gettimeoffset();
}

static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
Expand All @@ -202,7 +196,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);

/* If arch requires, add in get_arch_timeoffset() */
return nsec + get_arch_timeoffset();
return nsec + arch_gettimeoffset();
}

static RAW_NOTIFIER_HEAD(pvclock_gtod_chain);
Expand Down Expand Up @@ -282,7 +276,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
tk->xtime_nsec += cycle_delta * tk->mult;

/* If arch requires, add in get_arch_timeoffset() */
tk->xtime_nsec += (u64)get_arch_timeoffset() << tk->shift;
tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift;

tk_normalize_xtime(tk);

Expand Down

0 comments on commit e06fde3

Please sign in to comment.