[PATCH 02/16] timekeeping: Use u32 for clock_was_set_seq

From: Thomas Weißschuh (Schneider Electric)

Date: Thu Jul 30 2026 - 03:04:20 EST


Use an explicitly sized type to make the code a bit more consistent
with other fields of the datastructure and other sequence counters.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@xxxxxxxxxxxxx>
---
include/linux/hrtimer_bases.h | 2 +-
include/linux/timekeeper_internal.h | 2 +-
include/linux/timekeeping.h | 2 +-
kernel/time/timekeeping.c | 3 ++-
4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/linux/hrtimer_bases.h b/include/linux/hrtimer_bases.h
index 70b99e651168..d4c83ec5c0f8 100644
--- a/include/linux/hrtimer_bases.h
+++ b/include/linux/hrtimer_bases.h
@@ -84,7 +84,7 @@ struct hrtimer_cpu_base {
raw_spinlock_t lock;
unsigned int cpu;
unsigned int active_bases;
- unsigned int clock_was_set_seq;
+ u32 clock_was_set_seq;
bool hres_active;
bool deferred_rearm;
bool deferred_needs_update;
diff --git a/include/linux/timekeeper_internal.h b/include/linux/timekeeper_internal.h
index 9c198f65621b..fe077d97b5f8 100644
--- a/include/linux/timekeeper_internal.h
+++ b/include/linux/timekeeper_internal.h
@@ -169,7 +169,7 @@ struct timekeeper {
u32 cs_ns_to_cyc_mult;
u32 cs_ns_to_cyc_shift;
u64 cs_ns_to_cyc_maxns;
- unsigned int clock_was_set_seq;
+ u32 clock_was_set_seq;
u8 cs_was_changed_seq;
u8 clock_valid;

diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index b4191a873c39..1345550d45b4 100644
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -301,7 +301,7 @@ struct system_time_snapshot {
ktime_t monoraw;
enum clocksource_ids cs_id;
enum clocksource_ids hw_csid;
- unsigned int clock_was_set_seq;
+ u32 clock_was_set_seq;
u8 cs_was_changed_seq;
u8 valid;
};
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index d4cdbcdcb9df..4421f83344d3 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -1563,10 +1563,11 @@ int get_device_system_crosststamp(int (*get_time_fn)
struct system_device_crosststamp *xtstamp)
{
u64 syscnt_cycles, cycles, now, interval_start;
- unsigned int seq, clock_was_set_seq = 0;
ktime_t base_sys, base_raw, *offs;
+ u32 clock_was_set_seq = 0;
u64 nsec_sys, nsec_raw;
u8 cs_was_changed_seq;
+ unsigned int seq;
bool do_interp;
struct timekeeper *tk;
struct tk_data *tkd;

--
2.55.0