]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: mt76: mt7921: refactor CLC support check flow
authorJB Tsai <jb.tsai@mediatek.com>
Tue, 3 Mar 2026 05:36:34 +0000 (13:36 +0800)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 Jun 2026 10:20:44 +0000 (10:20 +0000)
Move the disable_clc module parameter to regd.c and introduce
mt7921_regd_clc_supported() to centralize CLC support checks.

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: JB Tsai <jb.tsai@mediatek.com>
Link: https://patch.msgid.link/20260303053637.465465-2-jb.tsai@mediatek.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
drivers/net/wireless/mediatek/mt76/mt7921/regd.c
drivers/net/wireless/mediatek/mt76/mt7921/regd.h

index 8442dbd2ee23f89f0c9ef99e0930b7770ceafda4..9777c899e503f3ae0b373434d8107c9dedc0ae75 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/fs.h>
 #include <linux/firmware.h>
 #include "mt7921.h"
+#include "regd.h"
 #include "mcu.h"
 #include "../mt76_connac2_mac.h"
 #include "../mt792x_trace.h"
 #define MT_STA_BFER                    BIT(0)
 #define MT_STA_BFEE                    BIT(1)
 
-static bool mt7921_disable_clc;
-module_param_named(disable_clc, mt7921_disable_clc, bool, 0644);
-MODULE_PARM_DESC(disable_clc, "disable CLC support");
-
 int mt7921_mcu_parse_response(struct mt76_dev *mdev, int cmd,
                              struct sk_buff *skb, int seq)
 {
@@ -422,8 +419,7 @@ static int mt7921_load_clc(struct mt792x_dev *dev, const char *fw_name)
        u8 *clc_base = NULL, hw_encap = 0;
 
        dev->phy.clc_chan_conf = 0xff;
-       if (mt7921_disable_clc ||
-           mt76_is_usb(&dev->mt76))
+       if (!mt7921_regd_clc_supported(dev))
                return 0;
 
        if (mt76_is_mmio(&dev->mt76)) {
index 51dbbadbc63a9a9ca009500315ea1c185e723ddd..94334298496533cba7fde3f3981e5c597a7ee8c2 100644 (file)
@@ -6,6 +6,19 @@
 #include "regd.h"
 #include "mcu.h"
 
+static bool mt7921_disable_clc;
+module_param_named(disable_clc, mt7921_disable_clc, bool, 0644);
+MODULE_PARM_DESC(disable_clc, "disable CLC support");
+
+bool mt7921_regd_clc_supported(struct mt792x_dev *dev)
+{
+       if (mt7921_disable_clc ||
+           mt76_is_usb(&dev->mt76))
+               return false;
+
+       return true;
+}
+
 static void
 mt7921_regd_channel_update(struct wiphy *wiphy, struct mt792x_dev *dev)
 {
index 2907b78d375b8bb70bfa6a6adad53afb8616f8d0..ece85feb7a23d5fc1f535188c2c1ee4220a0e776 100644 (file)
@@ -11,5 +11,6 @@ struct regulatory_request;
 void mt7921_regd_update(struct mt792x_dev *dev);
 void mt7921_regd_notifier(struct wiphy *wiphy,
                          struct regulatory_request *request);
+bool mt7921_regd_clc_supported(struct mt792x_dev *dev);
 
 #endif