Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

timekeeping: Mark offsets array as const

Neither the array nor the offsets it is pointing to are meant to be
changed through the array.

Mark both the array and the values it points to as const.

Signed-off-by: Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260311-hrtimer-cleanups-v1-5-095357392669@linutronix.de

authored by

Thomas Weißschuh (Schneider Electric) and committed by
Thomas Gleixner
112c685f ba546d3d

+6 -4
+6 -4
kernel/time/timekeeping.c
··· 989 989 } 990 990 EXPORT_SYMBOL_GPL(ktime_get_resolution_ns); 991 991 992 - static ktime_t *offsets[TK_OFFS_MAX] = { 992 + static const ktime_t *const offsets[TK_OFFS_MAX] = { 993 993 [TK_OFFS_REAL] = &tk_core.timekeeper.offs_real, 994 994 [TK_OFFS_BOOT] = &tk_core.timekeeper.offs_boot, 995 995 [TK_OFFS_TAI] = &tk_core.timekeeper.offs_tai, ··· 998 998 ktime_t ktime_get_with_offset(enum tk_offsets offs) 999 999 { 1000 1000 struct timekeeper *tk = &tk_core.timekeeper; 1001 + const ktime_t *offset = offsets[offs]; 1001 1002 unsigned int seq; 1002 - ktime_t base, *offset = offsets[offs]; 1003 + ktime_t base; 1003 1004 u64 nsecs; 1004 1005 1005 1006 WARN_ON(timekeeping_suspended); ··· 1020 1019 ktime_t ktime_get_coarse_with_offset(enum tk_offsets offs) 1021 1020 { 1022 1021 struct timekeeper *tk = &tk_core.timekeeper; 1023 - ktime_t base, *offset = offsets[offs]; 1022 + const ktime_t *offset = offsets[offs]; 1024 1023 unsigned int seq; 1024 + ktime_t base; 1025 1025 u64 nsecs; 1026 1026 1027 1027 WARN_ON(timekeeping_suspended); ··· 1045 1043 */ 1046 1044 ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs) 1047 1045 { 1048 - ktime_t *offset = offsets[offs]; 1046 + const ktime_t *offset = offsets[offs]; 1049 1047 unsigned int seq; 1050 1048 ktime_t tconv; 1051 1049