]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: rt2x00: Switch to use hrtimer_update_function()
authorNam Cao <namcao@linutronix.de>
Wed, 5 Feb 2025 10:55:15 +0000 (11:55 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 18 Feb 2025 16:41:35 +0000 (17:41 +0100)
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/82dcc0eae40bb84e6452f242751c0650e79bd87e.1738746927.git.namcao@linutronix.de
drivers/net/wireless/ralink/rt2x00/rt2800mmio.c
drivers/net/wireless/ralink/rt2x00/rt2800usb.c

index 5323acff962a38c9f9b65a0a92880b1376f4a719..45775ecdf22157ba8c799bd596940d2cde9d2385 100644 (file)
@@ -842,7 +842,7 @@ int rt2800mmio_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * Set txstatus timer function.
         */
-       rt2x00dev->txstatus_timer.function = rt2800mmio_tx_sta_fifo_timeout;
+       hrtimer_update_function(&rt2x00dev->txstatus_timer, rt2800mmio_tx_sta_fifo_timeout);
 
        /*
         * Overwrite TX done handler
index 160bef79acdb79c3e64dd2aaa34211d47bf82238..b51a23300ba24d8028406bb8dd341245cc7b682a 100644 (file)
@@ -618,7 +618,7 @@ static int rt2800usb_probe_hw(struct rt2x00_dev *rt2x00dev)
        /*
         * Set txstatus timer function.
         */
-       rt2x00dev->txstatus_timer.function = rt2800usb_tx_sta_fifo_timeout;
+       hrtimer_update_function(&rt2x00dev->txstatus_timer, rt2800usb_tx_sta_fifo_timeout);
 
        /*
         * Overwrite TX done handler