[openwrt/openwrt] mt76: fix build error on 6.12 kernel

LEDE Commits lede-commits at lists.infradead.org
Sat May 3 11:27:28 PDT 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5652c91a3f7be9819e986e38e1f88b6c229d84f0

commit 5652c91a3f7be9819e986e38e1f88b6c229d84f0
Author: Shiji Yang <yangshiji66 at outlook.com>
AuthorDate: Mon Apr 28 22:24:45 2025 +0800

    mt76: fix build error on 6.12 kernel
    
    Convert platform driver .remove to .remove_new to fix the
    incompatible pointer type error on 6.12 kernel.
    
    Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
    Link: https://github.com/openwrt/openwrt/pull/18637
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 ...onvert-platform-driver-.remove-to-.remove.patch | 98 ++++++++++++++++++++++
 1 file changed, 98 insertions(+)

diff --git a/package/kernel/mt76/patches/001-wifi-mt76-convert-platform-driver-.remove-to-.remove.patch b/package/kernel/mt76/patches/001-wifi-mt76-convert-platform-driver-.remove-to-.remove.patch
new file mode 100644
index 0000000000..1fd82660cf
--- /dev/null
+++ b/package/kernel/mt76/patches/001-wifi-mt76-convert-platform-driver-.remove-to-.remove.patch
@@ -0,0 +1,98 @@
+From: Shiji Yang <yangshiji66 at outlook.com>
+Date: Mon, 28 Apr 2025 22:16:03 +0800
+Subject: [PATCH] wifi: mt76: convert platform driver .remove to .remove_new
+
+This conversion can make the mt76 driver compatible with both
+the 6.6 and 6.12 kernels. Fixes build error on 6.12:
+
+/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/mt76-2025.04.11~be28ef77/mt7603/soc.c:77:27: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Werror=incompatible-pointer-types]
+   77 |         .remove         = mt76_wmac_remove,
+      |                           ^~~~~~~~~~~~~~~~
+
+Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
+---
+ mt7603/soc.c | 6 ++----
+ mt7615/soc.c | 6 ++----
+ mt7915/soc.c | 6 ++----
+ 3 files changed, 6 insertions(+), 12 deletions(-)
+
+--- a/mt7603/soc.c
++++ b/mt7603/soc.c
+@@ -52,15 +52,13 @@ error:
+ 	return ret;
+ }
+ 
+-static int
++static void
+ mt76_wmac_remove(struct platform_device *pdev)
+ {
+ 	struct mt76_dev *mdev = platform_get_drvdata(pdev);
+ 	struct mt7603_dev *dev = container_of(mdev, struct mt7603_dev, mt76);
+ 
+ 	mt7603_unregister_device(dev);
+-
+-	return 0;
+ }
+ 
+ static const struct of_device_id of_wmac_match[] = {
+@@ -74,7 +72,7 @@ MODULE_FIRMWARE(MT7628_FIRMWARE_E2);
+ 
+ struct platform_driver mt76_wmac_driver = {
+ 	.probe		= mt76_wmac_probe,
+-	.remove		= mt76_wmac_remove,
++	.remove_new	= mt76_wmac_remove,
+ 	.driver = {
+ 		.name = "mt76_wmac",
+ 		.of_match_table = of_wmac_match,
+--- a/mt7615/soc.c
++++ b/mt7615/soc.c
+@@ -45,13 +45,11 @@ static int mt7622_wmac_probe(struct plat
+ 	return mt7615_mmio_probe(&pdev->dev, mem_base, irq, mt7615e_reg_map);
+ }
+ 
+-static int mt7622_wmac_remove(struct platform_device *pdev)
++static void mt7622_wmac_remove(struct platform_device *pdev)
+ {
+ 	struct mt7615_dev *dev = platform_get_drvdata(pdev);
+ 
+ 	mt7615_unregister_device(dev);
+-
+-	return 0;
+ }
+ 
+ static const struct of_device_id mt7622_wmac_of_match[] = {
+@@ -65,7 +63,7 @@ struct platform_driver mt7622_wmac_drive
+ 		.of_match_table = mt7622_wmac_of_match,
+ 	},
+ 	.probe = mt7622_wmac_probe,
+-	.remove = mt7622_wmac_remove,
++	.remove_new = mt7622_wmac_remove,
+ };
+ 
+ MODULE_FIRMWARE(MT7622_FIRMWARE_N9);
+--- a/mt7915/soc.c
++++ b/mt7915/soc.c
+@@ -1283,13 +1283,11 @@ free_device:
+ 	return ret;
+ }
+ 
+-static int mt798x_wmac_remove(struct platform_device *pdev)
++static void mt798x_wmac_remove(struct platform_device *pdev)
+ {
+ 	struct mt7915_dev *dev = platform_get_drvdata(pdev);
+ 
+ 	mt7915_unregister_device(dev);
+-
+-	return 0;
+ }
+ 
+ static const struct of_device_id mt798x_wmac_of_match[] = {
+@@ -1306,7 +1304,7 @@ struct platform_driver mt798x_wmac_drive
+ 		.of_match_table = mt798x_wmac_of_match,
+ 	},
+ 	.probe = mt798x_wmac_probe,
+-	.remove = mt798x_wmac_remove,
++	.remove_new = mt798x_wmac_remove,
+ };
+ 
+ MODULE_FIRMWARE(MT7986_FIRMWARE_WA);




More information about the lede-commits mailing list