Skip to content

Commit e06fde3

Browse files
KAGA-KOKOjohnstultz-work
authored andcommitted
timekeeping: Simplify arch_gettimeoffset()
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 <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Signed-off-by: John Stultz <[email protected]>
1 parent dc01c9f commit e06fde3

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

kernel/time/timekeeping.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,10 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
153153
/* Timekeeper helper functions. */
154154

155155
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
156-
u32 (*arch_gettimeoffset)(void);
157-
158-
u32 get_arch_timeoffset(void)
159-
{
160-
if (likely(arch_gettimeoffset))
161-
return arch_gettimeoffset();
162-
return 0;
163-
}
156+
static u32 default_arch_gettimeoffset(void) { return 0; }
157+
u32 (*arch_gettimeoffset)(void) = default_arch_gettimeoffset;
164158
#else
165-
static inline u32 get_arch_timeoffset(void) { return 0; }
159+
static inline u32 arch_gettimeoffset(void) { return 0; }
166160
#endif
167161

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

184178
/* If arch requires, add in get_arch_timeoffset() */
185-
return nsec + get_arch_timeoffset();
179+
return nsec + arch_gettimeoffset();
186180
}
187181

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

204198
/* If arch requires, add in get_arch_timeoffset() */
205-
return nsec + get_arch_timeoffset();
199+
return nsec + arch_gettimeoffset();
206200
}
207201

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

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

287281
tk_normalize_xtime(tk);
288282

0 commit comments

Comments
 (0)