Re: [PATCH] include: linux: Reorganize timekeeping and ktime headers

From: Arnd Bergmann
Date: Thu Jul 15 2021 - 15:10:16 EST


On Thu, Jul 15, 2021 at 6:12 PM Carlos Bilbao <bilbao@xxxxxx> wrote:
>
> Reorganize and separate the headers by making ktime.h take care of the
> ktime_get() family of functions, and reserve timekeeping.h for the actual
> timekeeping. This also helps to avoid implicit function errors and strengthens
> the header dependencies, since timekeeping.h was using ktime_to_ns(), a static
> function defined in a header it does no include, ktime.h. This patch also
> includes the header timekeeping.h wherever it is necessary for a successful
> compilation after the header code reorganization.
>
> Signed-off-by: Carlos Bilbao <bilbao@xxxxxx>
> ---
> arch/x86/kernel/tsc.c | 1 +
> include/linux/ktime.h | 196 +++++++++++++++++++++++++++++++++++-
> include/linux/sched_clock.h | 2 +
> include/linux/timekeeping.h | 196 +-----------------------------------
> init/main.c | 1 +
> kernel/time/ntp.c | 1 +
> kernel/time/time.c | 1 +
> kernel/time/timekeeping.c | 1 +
> 8 files changed, 202 insertions(+), 197 deletions(-)

This looks reasonable overall. I'm not sure if Thomas has other plans for this
header, as he created the timekeeping.h one originally. There is also the
potential for build regressions when additional files depend on timekeeping.h
but don't include it directly. Hopefully the kbuild bot will warn us about
any of those.

Arnd