* [PATCH] wifi: mt76: use hrtimer_setup() in mt76x02u beacon init
[not found] <321f7c0e-2ae7-4633-beac-51bcfac4f4bb.ref@yahoo.com>
@ 2026-04-20 14:42 ` Mieczyslaw Nalewaj
2026-04-20 17:32 ` Lorenzo Bianconi
0 siblings, 1 reply; 2+ messages in thread
From: Mieczyslaw Nalewaj @ 2026-04-20 14:42 UTC (permalink / raw)
To: linux-wireless
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 <namiltd@yahoo.com>
---
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);
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wifi: mt76: use hrtimer_setup() in mt76x02u beacon init
2026-04-20 14:42 ` [PATCH] wifi: mt76: use hrtimer_setup() in mt76x02u beacon init Mieczyslaw Nalewaj
@ 2026-04-20 17:32 ` Lorenzo Bianconi
0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2026-04-20 17:32 UTC (permalink / raw)
To: Mieczyslaw Nalewaj; +Cc: linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1445 bytes --]
> 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 <namiltd@yahoo.com>
> ---
> 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);
I guess we are already using hrtimer_setup():
https://github.com/torvalds/linux/blob/master/drivers/net/wireless/mediatek/mt76/mt76x02_usb_core.c#L267
Regards,
Lorenzo
> INIT_WORK(&dev->pre_tbtt_work, mt76x02u_pre_tbtt_work);
>
> mt76x02_init_beacon_config(dev);
> --
> 2.53.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-20 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <321f7c0e-2ae7-4633-beac-51bcfac4f4bb.ref@yahoo.com>
2026-04-20 14:42 ` [PATCH] wifi: mt76: use hrtimer_setup() in mt76x02u beacon init Mieczyslaw Nalewaj
2026-04-20 17:32 ` Lorenzo Bianconi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox