Prechádzať zdrojové kódy

rtl8812au-ct: fix build issue on 6.12 kernel

Update USB shutdown callback for the 6.12 kernel. A sprintf
overlaps issue is also fixed in this patch. Unfortunately,
there are dozens of missing-prototypes warnings so it's hard
to fix them one by one. Let's just silence them.

Signed-off-by: Shiji Yang <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/18637
Signed-off-by: Hauke Mehrtens <[email protected]>
Shiji Yang 8 mesiacov pred
rodič
commit
2260afa381

+ 1 - 0
package/kernel/rtl8812au-ct/Makefile

@@ -41,6 +41,7 @@ NOSTDINC_FLAGS := \
 	-I$(STAGING_DIR)/usr/include/mac80211/uapi \
 	-include backport/backport.h \
 	-Wno-error=address \
+	-Wno-error=missing-prototypes \
 	-Wno-error=stringop-overread
 
 NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT

+ 47 - 0
package/kernel/rtl8812au-ct/patches/010-fix-usb_driver-.shutdown-callback.patch

@@ -0,0 +1,47 @@
+From: Shiji Yang <[email protected]>
+Date: Tue, 29 Apr 2025 01:49:40 +0800
+Subject: [PATCH] fix usb_driver .shutdown callback
+
+Update API to fix build error on 6.12 kernel:
+
+/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/os_dep/linux/usb_intf.c:393:17: error: 'struct usb_driver' has no member named 'drvwrap'
+  393 |         .usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
+      |                 ^~~~~~~
+/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/os_dep/linux/usb_intf.c:393:43: error: initialization of 'const char *' from incompatible pointer type 'void (*)(struct device *)' [-Werror=incompatible-pointer-types]
+  393 |         .usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
+      |                                           ^~~~~~~~~~~~~~~~
+
+Link: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.11.y&id=a5f81642a7228489292f842a106e33c558121e8b
+Signed-off-by: Shiji Yang <[email protected]>
+---
+ os_dep/linux/usb_intf.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+--- a/os_dep/linux/usb_intf.c
++++ b/os_dep/linux/usb_intf.c
+@@ -49,9 +49,14 @@ static int rtw_resume(struct usb_interfa
+ static int rtw_drv_init(struct usb_interface *pusb_intf,const struct usb_device_id *pdid);
+ static void rtw_dev_remove(struct usb_interface *pusb_intf);
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0))
++static void rtw_dev_shutdown(struct usb_interface *usb_intf)
++{
++#else
+ static void rtw_dev_shutdown(struct device *dev)
+ {
+ 	struct usb_interface *usb_intf = container_of(dev, struct usb_interface, dev);
++#endif
+ 	struct dvobj_priv *dvobj = NULL;
+ 	_adapter *adapter = NULL;
+ 	int i;
+@@ -389,7 +394,9 @@ struct rtw_usb_drv usb_drv = {
+ 	.usbdrv.supports_autosuspend = 1,
+ #endif
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0))
++	.usbdrv.shutdown = rtw_dev_shutdown,
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19))
+ 	.usbdrv.drvwrap.driver.shutdown = rtw_dev_shutdown,
+ #else
+ 	.usbdrv.driver.shutdown = rtw_dev_shutdown,

+ 28 - 0
package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch

@@ -0,0 +1,28 @@
+From: Shiji Yang <[email protected]>
+Date: Tue, 29 Apr 2025 00:21:50 +0800
+Subject: [PATCH] fix sprintf() overlaps destination object warning
+
+/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/core/rtw_mp.c: In function 'mp_query_psd':
+/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/core/rtw_mp.c:1874:17: error: 'sprintf' argument 3 overlaps destination object 'data' [-Werror=restrict]
+ 1874 |                 sprintf(data, "%s%x ", data, psd_data);
+      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+/workspaces/openwrt/build_dir/target-x86_64_musl/linux-x86_64/rtl8812au-ct-2022.10.26~9b2b203a/core/rtw_mp.c:1839:41: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
+ 1839 | u32 mp_query_psd(PADAPTER pAdapter, u8 *data)
+      |                                     ~~~~^~~~
+
+Signed-off-by: Shiji Yang <[email protected]>
+---
+ core/rtw_mp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/core/rtw_mp.c
++++ b/core/rtw_mp.c
+@@ -1871,7 +1871,7 @@ u32 mp_query_psd(PADAPTER pAdapter, u8 *
+ 		} else {
+ 			psd_data = rtw_GetPSDData(pAdapter, i);
+ 		}
+-		sprintf(data, "%s%x ", data, psd_data);
++		sprintf(data + strlen(data), "%x ", psd_data);
+ 		i++;
+ 	}
+ 

+ 1 - 1
package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch

@@ -72,7 +72,7 @@ This reverts commit a027da58e8d8e95827f97222ca321cd0b2d377dd.
  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
                                          , bool unicast, bool multicast
  #endif
-@@ -4033,11 +4018,7 @@ static int cfg80211_rtw_change_beacon(st
+@@ -4046,11 +4031,7 @@ static int cfg80211_rtw_change_beacon(st
  	return ret;
  }
  

+ 1 - 1
package/kernel/rtl8812au-ct/patches/100-api_update.patch

@@ -44,7 +44,7 @@
  #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE)
                                          , bool unicast, bool multicast
  #endif
-@@ -4018,7 +4021,8 @@ static int cfg80211_rtw_change_beacon(st
+@@ -4031,7 +4034,8 @@ static int cfg80211_rtw_change_beacon(st
  	return ret;
  }