From ac9ea1be34e5e471ac7017a40ff9a7e57882994a Mon Sep 17 00:00:00 2001 From: Mieczyslaw Nalewaj Date: Thu, 29 Jan 2026 16:48:20 +0100 Subject: [PATCH] mt76: use hrtimer_setup() in mt76x02u beacon init Replace the two-step hrtimer initialization pattern with a single consolidated call to hrtimer_setup(). The legacy approach of calling hrtimer_init() followed by manual assignment to timer.function is deprecated. The new hrtimer_setup() helper atomically initializes the timer and assigns the callback function in one operation, eliminating the race-prone intermediate state where the timer is initialized but lacks a handler. Signed-off-by: Mieczyslaw Nalewaj Link: https://github.com/openwrt/openwrt/pull/21078 Signed-off-by: Robert Marko --- ...rtimer_setup-in-mt76x02u-beacon-init.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 package/kernel/mt76/patches/002-use-hrtimer_setup-in-mt76x02u-beacon-init.patch diff --git a/package/kernel/mt76/patches/002-use-hrtimer_setup-in-mt76x02u-beacon-init.patch b/package/kernel/mt76/patches/002-use-hrtimer_setup-in-mt76x02u-beacon-init.patch new file mode 100644 index 0000000000..705104cc4b --- /dev/null +++ b/package/kernel/mt76/patches/002-use-hrtimer_setup-in-mt76x02u-beacon-init.patch @@ -0,0 +1,33 @@ +From a95e567eb0e06d460dee234f9c845fbfb215ab11 Mon Sep 17 00:00:00 2001 +From: Mieczyslaw Nalewaj +Date: Thu, 29 Jan 2026 16:36:25 +0100 +Subject: [PATCH] wifi: mt76: use hrtimer_setup() in mt76x02u beacon init + +Replace the two-step hrtimer initialization pattern with a single +consolidated call to hrtimer_setup(). +The legacy approach of calling hrtimer_init() followed by manual +assignment to timer.function is deprecated. The new hrtimer_setup() +helper atomically initializes the timer and assigns the callback +function in one operation, eliminating the race-prone intermediate +state where the timer is initialized but lacks a handler. + +Signed-off-by: Mieczyslaw Nalewaj +--- + mt76x02_usb_core.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mt76x02_usb_core.c b/mt76x02_usb_core.c +index c94c2f661..3a28a8cc1 100644 +--- a/mt76x02_usb_core.c ++++ b/mt76x02_usb_core.c +@@ -264,8 +264,8 @@ void mt76x02u_init_beacon_config(struct mt76x02_dev *dev) + }; + dev->beacon_ops = &beacon_ops; + +- hrtimer_init(&dev->pre_tbtt_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); +- dev->pre_tbtt_timer.function = mt76x02u_pre_tbtt_interrupt; ++ hrtimer_setup(&dev->pre_tbtt_timer, mt76x02u_pre_tbtt_interrupt, CLOCK_MONOTONIC, ++ HRTIMER_MODE_REL); + INIT_WORK(&dev->pre_tbtt_work, mt76x02u_pre_tbtt_work); + + mt76x02_init_beacon_config(dev);