Skip to content

Commit eee00df

Browse files
covanamKAGA-KOKO
authored andcommitted
serial: xilinx_uartps: Use helper function hrtimer_update_function()
The field 'function' of struct hrtimer should not be changed directly, as the write is lockless and a concurrent timer expiry might end up using the wrong function pointer. Switch to use hrtimer_update_function() which also performs runtime checks that it is safe to modify the callback. Signed-off-by: Nam Cao <namcao@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/af7823518fb060c6c97105a2513cfc61adbdf38f.1738746927.git.namcao@linutronix.de
1 parent ce68de0 commit eee00df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/tty/serial/xilinx_uartps.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static void cdns_uart_handle_tx(void *dev_id)
454454

455455
if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED &&
456456
(kfifo_is_empty(&tport->xmit_fifo) || uart_tx_stopped(port))) {
457-
cdns_uart->tx_timer.function = &cdns_rs485_rx_callback;
457+
hrtimer_update_function(&cdns_uart->tx_timer, cdns_rs485_rx_callback);
458458
hrtimer_start(&cdns_uart->tx_timer,
459459
ns_to_ktime(cdns_calc_after_tx_delay(cdns_uart)), HRTIMER_MODE_REL);
460460
}
@@ -734,7 +734,7 @@ static void cdns_uart_start_tx(struct uart_port *port)
734734

735735
if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) {
736736
if (!cdns_uart->rs485_tx_started) {
737-
cdns_uart->tx_timer.function = &cdns_rs485_tx_callback;
737+
hrtimer_update_function(&cdns_uart->tx_timer, cdns_rs485_tx_callback);
738738
cdns_rs485_tx_setup(cdns_uart);
739739
return hrtimer_start(&cdns_uart->tx_timer,
740740
ms_to_ktime(port->rs485.delay_rts_before_send),

0 commit comments

Comments
 (0)