From: Petr Wozniak <petr.wozniak@gmail.com>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>
Cc: Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
linux-wireless@vger.kernel.org,
Petr Wozniak <petr.wozniak@gmail.com>
Subject: [PATCH 1/2] wifi: mt76: share the throughput LED trigger across bands
Date: Sun, 28 Jun 2026 11:53:12 +0200 [thread overview]
Message-ID: <20260628095313.7790-2-petr.wozniak@gmail.com> (raw)
In-Reply-To: <20260628095313.7790-1-petr.wozniak@gmail.com>
ieee80211_create_tpt_led_trigger() creates one trigger per ieee80211_hw
and returns NULL with a WARN_ON() if called again for the same hw.
Under the single-wiphy MLO model each band registers its own LED classdev
for the same hw, and the bands can be initialised in any order. Create the
trigger on the first mt76_led_init() call, stash it on the primary phy's
classdev and let the other bands reuse it. This avoids the WARN_ON() splat
and gives every band the same throughput trigger regardless of init order.
Signed-off-by: Petr Wozniak <petr.wozniak@gmail.com>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index 13c4e8abe..e56fb95ce 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -228,11 +228,19 @@ static int mt76_led_init(struct mt76_phy *phy)
wiphy_name(hw->wiphy));
phy->leds.cdev.name = phy->leds.name;
- phy->leds.cdev.default_trigger =
- ieee80211_create_tpt_led_trigger(hw,
- IEEE80211_TPT_LEDTRIG_FL_RADIO,
- mt76_tpt_blink,
- ARRAY_SIZE(mt76_tpt_blink));
+ /* The throughput trigger is created once per ieee80211_hw. Under
+ * single-wiphy MLO every band registers its own LED classdev for the
+ * same hw and the bands can come up in any order, so create the trigger
+ * on the first call, stash it on the primary phy and let the other bands
+ * reuse it; calling it again would trip a WARN_ON().
+ */
+ if (!dev->phy.leds.cdev.default_trigger)
+ dev->phy.leds.cdev.default_trigger =
+ ieee80211_create_tpt_led_trigger(hw,
+ IEEE80211_TPT_LEDTRIG_FL_RADIO,
+ mt76_tpt_blink,
+ ARRAY_SIZE(mt76_tpt_blink));
+ phy->leds.cdev.default_trigger = dev->phy.leds.cdev.default_trigger;
dev_info(dev->dev,
"registering led '%s'\n", phy->leds.name);
--
2.51.0
next prev parent reply other threads:[~2026-06-28 9:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 9:53 [PATCH 0/2] wifi: mt76: fix per-band LEDs under single-wiphy MLO Petr Wozniak
2026-06-28 9:53 ` Petr Wozniak [this message]
2026-06-28 9:53 ` [PATCH 2/2] wifi: mt76: mt7996: register a LED classdev for every band Petr Wozniak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260628095313.7790-2-petr.wozniak@gmail.com \
--to=petr.wozniak@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox