Skip to content

Commit 8080197

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
vdso/gettimeofday: Prepare helper functions for introduction of struct vdso_clock
To support multiple PTP clocks, the VDSO data structure needs to be reworked. All clock specific data will end up in struct vdso_clock and in struct vdso_time_data there will be array of VDSO clocks. At the moment, vdso_clock is simply a define which maps vdso_clock to vdso_time_data. To prepare for the rework of the data structures, replace the struct vdso_time_data pointer argument of the helper functions with struct vdso_clock pointer where applicable. No functional change. Signed-off-by: Anna-Maria Behnsen <[email protected]> Signed-off-by: Nam Cao <[email protected]> Signed-off-by: Thomas Weißschuh <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 8c3f5cb commit 8080197

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/vdso/gettimeofday.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
#endif
1818

1919
#ifdef CONFIG_GENERIC_VDSO_OVERFLOW_PROTECT
20-
static __always_inline bool vdso_delta_ok(const struct vdso_time_data *vd, u64 delta)
20+
static __always_inline bool vdso_delta_ok(const struct vdso_clock *vc, u64 delta)
2121
{
22-
return delta < vd->max_cycles;
22+
return delta < vc->max_cycles;
2323
}
2424
#else
25-
static __always_inline bool vdso_delta_ok(const struct vdso_time_data *vd, u64 delta)
25+
static __always_inline bool vdso_delta_ok(const struct vdso_clock *vc, u64 delta)
2626
{
2727
return true;
2828
}
@@ -39,14 +39,14 @@ static __always_inline u64 vdso_shift_ns(u64 ns, u32 shift)
3939
* Default implementation which works for all sane clocksources. That
4040
* obviously excludes x86/TSC.
4141
*/
42-
static __always_inline u64 vdso_calc_ns(const struct vdso_time_data *vd, u64 cycles, u64 base)
42+
static __always_inline u64 vdso_calc_ns(const struct vdso_clock *vc, u64 cycles, u64 base)
4343
{
44-
u64 delta = (cycles - vd->cycle_last) & VDSO_DELTA_MASK(vd);
44+
u64 delta = (cycles - vc->cycle_last) & VDSO_DELTA_MASK(vc);
4545

46-
if (likely(vdso_delta_ok(vd, delta)))
47-
return vdso_shift_ns((delta * vd->mult) + base, vd->shift);
46+
if (likely(vdso_delta_ok(vc, delta)))
47+
return vdso_shift_ns((delta * vc->mult) + base, vc->shift);
4848

49-
return mul_u64_u32_add_u64_shr(delta, vd->mult, base, vd->shift);
49+
return mul_u64_u32_add_u64_shr(delta, vc->mult, base, vc->shift);
5050
}
5151
#endif /* vdso_calc_ns */
5252

@@ -58,9 +58,9 @@ static inline bool __arch_vdso_hres_capable(void)
5858
#endif
5959

6060
#ifndef vdso_clocksource_ok
61-
static inline bool vdso_clocksource_ok(const struct vdso_time_data *vd)
61+
static inline bool vdso_clocksource_ok(const struct vdso_clock *vc)
6262
{
63-
return vd->clock_mode != VDSO_CLOCKMODE_NONE;
63+
return vc->clock_mode != VDSO_CLOCKMODE_NONE;
6464
}
6565
#endif
6666

0 commit comments

Comments
 (0)