From 2260afa3813684098f5c536169be12afa55b292c Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 29 Apr 2025 00:01:42 +0800 Subject: [PATCH] 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 Link: https://github.com/openwrt/openwrt/pull/18637 Signed-off-by: Hauke Mehrtens --- package/kernel/rtl8812au-ct/Makefile | 1 + ...10-fix-usb_driver-.shutdown-callback.patch | 47 +++++++++++++++++++ ...-overlaps-destination-object-warning.patch | 28 +++++++++++ ...nkid-linux-version-code-conditionals.patch | 2 +- .../rtl8812au-ct/patches/100-api_update.patch | 2 +- 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 package/kernel/rtl8812au-ct/patches/010-fix-usb_driver-.shutdown-callback.patch create mode 100644 package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch diff --git a/package/kernel/rtl8812au-ct/Makefile b/package/kernel/rtl8812au-ct/Makefile index a994f350524..1492a753205 100644 --- a/package/kernel/rtl8812au-ct/Makefile +++ b/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 diff --git a/package/kernel/rtl8812au-ct/patches/010-fix-usb_driver-.shutdown-callback.patch b/package/kernel/rtl8812au-ct/patches/010-fix-usb_driver-.shutdown-callback.patch new file mode 100644 index 00000000000..66b3d674cbb --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/010-fix-usb_driver-.shutdown-callback.patch @@ -0,0 +1,47 @@ +From: Shiji Yang +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 +--- + 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, diff --git a/package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch b/package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch new file mode 100644 index 00000000000..d36b8f82dce --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch @@ -0,0 +1,28 @@ +From: Shiji Yang +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 +--- + 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++; + } + diff --git a/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch b/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch index bb644a9ace4..41a7fa2a8e6 100644 --- a/package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch +++ b/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; } diff --git a/package/kernel/rtl8812au-ct/patches/100-api_update.patch b/package/kernel/rtl8812au-ct/patches/100-api_update.patch index e7ca4b05f34..ca888d6963e 100644 --- a/package/kernel/rtl8812au-ct/patches/100-api_update.patch +++ b/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; }