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 /drivers/ptp | |
| parent | d0b3b7b22dfa1f4b515fd3a295b3fd958f9e81af (diff) | |
time/timecounter: Fix the lie that struct cyclecounter is const
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 'drivers/ptp')
| -rw-r--r-- | drivers/ptp/ptp_mock.c | 2 | ||||
| -rw-r--r-- | drivers/ptp/ptp_vclock.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ptp/ptp_mock.c b/drivers/ptp/ptp_mock.c index e7b459c846a2..bbd14ce24b34 100644 --- a/drivers/ptp/ptp_mock.c +++ b/drivers/ptp/ptp_mock.c @@ -41,7 +41,7 @@ struct mock_phc { spinlock_t lock; }; -static u64 mock_phc_cc_read(const struct cyclecounter *cc) +static u64 mock_phc_cc_read(struct cyclecounter *cc) { return ktime_get_raw_ns(); } diff --git a/drivers/ptp/ptp_vclock.c b/drivers/ptp/ptp_vclock.c index 7febfdcbde8b..2fdeedd60e21 100644 --- a/drivers/ptp/ptp_vclock.c +++ b/drivers/ptp/ptp_vclock.c @@ -164,7 +164,7 @@ static const struct ptp_clock_info ptp_vclock_info = { .do_aux_work = ptp_vclock_refresh, }; -static u64 ptp_vclock_read(const struct cyclecounter *cc) +static u64 ptp_vclock_read(struct cyclecounter *cc) { struct ptp_vclock *vclock = cc_to_vclock(cc); struct ptp_clock *ptp = vclock->pclock; |
