From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Ming Yen Hsieh <mingyen.hsieh@mediatek.com>,
JB Tsai <jb.tsai@mediatek.com>,
Allan Wang <allan.wang@mediatek.com>,
Quan Zhou <quan.zhou@mediatek.com>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: [PATCH wireless-next 1/2] wifi: mt76: allow LEDs with only brightness_set_blocking
Date: Tue, 3 Nov 2026 14:35:27 +0100 [thread overview]
Message-ID: <20261103133528.53197-2-pepe.schlehofer@gmail.com> (raw)
In-Reply-To: <20261103133528.53197-1-pepe.schlehofer@gmail.com>
mt76_led_init() and mt76_led_cleanup() skip the LED unless the driver
sets brightness_set or blink_set. A USB driver that switches its LED
through register writes has to sleep and can only provide
brightness_set_blocking. Accept that callback as well.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
drivers/net/wireless/mediatek/mt76/mac80211.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c
index c9762082f473..e3eea578a97c 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -193,13 +193,21 @@ static const struct cfg80211_sar_capa mt76_sar_capa = {
.freq_ranges = &mt76_sar_freq_ranges[0],
};
+static bool mt76_led_has_ops(struct mt76_phy *phy)
+{
+ struct led_classdev *cdev = &phy->leds.cdev;
+
+ return cdev->brightness_set || cdev->brightness_set_blocking ||
+ cdev->blink_set;
+}
+
static int mt76_led_init(struct mt76_phy *phy)
{
struct mt76_dev *dev = phy->dev;
struct ieee80211_hw *hw = phy->hw;
struct device_node *np = dev->dev->of_node;
- if (!phy->leds.cdev.brightness_set && !phy->leds.cdev.blink_set)
+ if (!mt76_led_has_ops(phy))
return 0;
np = of_get_child_by_name(np, "led");
@@ -242,7 +250,7 @@ static int mt76_led_init(struct mt76_phy *phy)
static void mt76_led_cleanup(struct mt76_phy *phy)
{
- if (!phy->leds.cdev.brightness_set && !phy->leds.cdev.blink_set)
+ if (!mt76_led_has_ops(phy))
return;
led_classdev_unregister(&phy->leds.cdev);
--
2.54.0 (Apple Git-157)
next prev parent reply other threads:[~2026-11-03 13:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 13:35 [PATCH wireless-next 0/2] wifi: mt76: mt7925: LED support for USB adapters Josef Schlehofer
2026-11-03 13:35 ` Josef Schlehofer [this message]
2026-11-03 13:35 ` [PATCH wireless-next 2/2] wifi: mt76: mt7925: add " Josef Schlehofer
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=20261103133528.53197-2-pepe.schlehofer@gmail.com \
--to=pepe.schlehofer@gmail.com \
--cc=allan.wang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=jb.tsai@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=mingyen.hsieh@mediatek.com \
--cc=nbd@nbd.name \
--cc=quan.zhou@mediatek.com \
--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