On Fri, Mar 8, 2024 at 5:15 AM Adrian Hunter <adrian.hunter@xxxxxxxxx> wrote: > > Consolidate vdso_calc_delta(), in preparation for further simplification. > > Suggested-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> > --- > arch/powerpc/include/asm/vdso/gettimeofday.h | 17 ++--------------- > arch/s390/include/asm/vdso/gettimeofday.h | 7 ++----- > lib/vdso/gettimeofday.c | 4 ++++ > 3 files changed, 8 insertions(+), 20 deletions(-) > > --- a/lib/vdso/gettimeofday.c > +++ b/lib/vdso/gettimeofday.c > @@ -13,7 +13,11 @@ > static __always_inline > u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult) > { > +#ifdef VDSO_DELTA_NOMASK > + return (cycles - last) * mult; > +#else > return ((cycles - last) & mask) * mult; > +#endif > } Nit: Just for readability, usually we avoid #ifdefs inside of functions. Instead maybe: #ifdef VDSO_DELTA_NOMASK static __always_inline u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult) { return (cycles - last) * mult; } #else static __always_inline u64 vdso_calc_delta(u64 cycles, u64 last, u64 mask, u32 mult) { return ((cycles - last) & mask) * mult; } #endif