rtl8812au-ct: fix build issue on 6.12 kernel
authorShiji Yang <[email protected]>
Mon, 28 Apr 2025 16:01:42 +0000 (00:01 +0800)
committerHauke Mehrtens <[email protected]>
Sat, 3 May 2025 18:16:25 +0000 (20:16 +0200)
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]>
package/kernel/rtl8812au-ct/Makefile
package/kernel/rtl8812au-ct/patches/010-fix-usb_driver-.shutdown-callback.patch [new file with mode: 0644]
package/kernel/rtl8812au-ct/patches/011-fix-sprintf-overlaps-destination-object-warning.patch [new file with mode: 0644]
package/kernel/rtl8812au-ct/patches/099-cut-linkid-linux-version-code-conditionals.patch
package/kernel/rtl8812au-ct/patches/100-api_update.patch

index a994f350524dadd45568fc2550314bc748ca0681..1492a7532052e287ef360a6fa8c2b4c84ef15665 100644 (file)
@@ -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 (file)
index 0000000..66b3d67
--- /dev/null
@@ -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,
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 (file)
index 0000000..d36b8f8
--- /dev/null
@@ -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++;
+       }
index bb644a9ace46c37879cf16700fc9f08345c5e962..41a7fa2a8e60cd3205284301f030fa1790c51928 100644 (file)
@@ -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;
  }
  
index e7ca4b05f3446bdf1c652a80d340c0ee91ab2120..ca888d6963e76c8924eef801b55777bdf46304ea 100644 (file)
@@ -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;
  }