]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
time/timecounter: Fix the lie that struct cyclecounter is const
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Jul 2025 12:32:25 +0000 (14:32 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 1 Jul 2025 13:38:25 +0000 (15:38 +0200)
commite78f70bad29c5ae1e1076698b690b15794e9b81e
treec0e75e23326513910d5309c2f5b98ff6bba2eefd
parentd0b3b7b22dfa1f4b515fd3a295b3fd958f9e81af
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
28 files changed:
arch/microblaze/kernel/timer.c
drivers/clocksource/arm_arch_timer.c
drivers/net/can/rockchip/rockchip_canfd-timestamp.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c
drivers/net/can/usb/gs_usb.c
drivers/net/dsa/mv88e6xxx/chip.h
drivers/net/dsa/mv88e6xxx/ptp.c
drivers/net/ethernet/amd/xgbe/xgbe-ptp.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
drivers/net/ethernet/cavium/common/cavium_ptp.c
drivers/net/ethernet/freescale/fec_ptp.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/igb/igb_ptp.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ptp.c
drivers/net/ethernet/mellanox/mlx4/en_clock.c
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_ptp.c
drivers/net/ethernet/pensando/ionic/ionic_phc.c
drivers/net/ethernet/qlogic/qede/qede_ptp.c
drivers/net/ethernet/ti/cpts.c
drivers/net/ethernet/wangxun/libwx/wx_ptp.c
drivers/ptp/ptp_mock.c
drivers/ptp/ptp_vclock.c
include/linux/timecounter.h
kernel/time/timecounter.c
sound/hda/hdac_stream.c