diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-07-01 14:32:25 +0200 |
|---|---|---|
| committer | Thomas Gleixner <tglx@linutronix.de> | 2025-07-01 15:38:25 +0200 |
| commit | e78f70bad29c5ae1e1076698b690b15794e9b81e (patch) | |
| tree | c0e75e23326513910d5309c2f5b98ff6bba2eefd /include | |
| parent | d0b3b7b22dfa1f4b515fd3a295b3fd958f9e81af (diff) | |
| download | tip-timers/cleanups.tar.gz | |
time/timecounter: Fix the lie that struct cyclecounter is consttimers-cleanups-2025-07-27timers/cleanups
In both the read callback for struct cyclecounter, and in struct
timecounter, struct cyclecounter is declared as a const pointer.
Unfortunatly, a number of users of this pointer treat it as a non-const
pointer as it is burried in a larger structure that is heavily modified by
the callback function when accessed. This lie had been hidden by the fact
that container_of() "casts away" a const attribute of a pointer without any
compiler warning happening at all.
Fix this all up by removing the const attribute in the needed places so
that everyone can see that the structure really isn't const, but can,
and is, modified by the users of it.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/2025070124-backyard-hurt-783a@gregkh
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/timecounter.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/timecounter.h b/include/linux/timecounter.h index 0982d1d52b24d9..dce03a5cafb7cf 100644 --- a/include/linux/timecounter.h +++ b/include/linux/timecounter.h @@ -28,7 +28,7 @@ * @shift: cycle to nanosecond divisor (power of two) */ struct cyclecounter { - u64 (*read)(const struct cyclecounter *cc); + u64 (*read)(struct cyclecounter *cc); u64 mask; u32 mult; u32 shift; @@ -53,7 +53,7 @@ struct cyclecounter { * @frac: accumulated fractional nanoseconds */ struct timecounter { - const struct cyclecounter *cc; + struct cyclecounter *cc; u64 cycle_last; u64 nsec; u64 mask; @@ -100,7 +100,7 @@ static inline void timecounter_adjtime(struct timecounter *tc, s64 delta) * the time stamp counter by the number of elapsed nanoseconds. */ extern void timecounter_init(struct timecounter *tc, - const struct cyclecounter *cc, + struct cyclecounter *cc, u64 start_tstamp); /** |
