From 5654a170929852e33b2bd4dd3501b3308aed055e Mon Sep 17 00:00:00 2001 From: everything411 Date: Thu, 21 Apr 2022 01:29:50 +0800 Subject: [PATCH] fix mtk mt7603e and mt7615d driver build error for kernel >= 5.15 (#9275) * fix mtk mt7603e and mt7615d driver build error for kernel version >= 5.15 no longer do get_fs and set_fs when build for kernel >= 5.15 for mt7603e and mt7615d driver. for new kernels, get_fs and set_fs is removed from kernel source, in mt7603e and mt7615d driver, kernel_write and kernel_read is used for newer kernel versions, and the two functions do not need get_fs and set_fs trick, so we can remove them safely. * use "help" instead of "---help---" in mt7603e Kconfig --- .../mt7603e/src/mt7603_wifi/os/linux/rt_linux.c | 16 ++++++++++++++++ .../drivers/mt7603e/src/mt7603_wifi_ap/Kconfig | 8 ++++---- .../mt7615d/src/mt_wifi/os/linux/rt_linux.c | 16 ++++++++++++++++ 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/package/lean/mt/drivers/mt7603e/src/mt7603_wifi/os/linux/rt_linux.c b/package/lean/mt/drivers/mt7603e/src/mt7603_wifi/os/linux/rt_linux.c index 68abbd8b4..98e3280bb 100644 --- a/package/lean/mt/drivers/mt7603e/src/mt7603_wifi/os/linux/rt_linux.c +++ b/package/lean/mt/drivers/mt7603e/src/mt7603_wifi/os/linux/rt_linux.c @@ -914,10 +914,14 @@ static inline void __RtmpOSFSInfoChange(OS_FS_INFO * pOSFSInfo, BOOLEAN bSet) #endif #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) pOSFSInfo->fs = get_fs(); set_fs(KERNEL_DS); +#endif } else { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(pOSFSInfo->fs); +#endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29) current->fsuid = pOSFSInfo->fsuid; current->fsgid = pOSFSInfo->fsgid; @@ -1936,8 +1940,10 @@ VOID RtmpDrvAllMacPrint( if (!msg) return; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) orig_fs = get_fs(); set_fs(KERNEL_DS); +#endif /* open file */ file_w = filp_open(fileName, O_WRONLY | O_CREAT, 0); @@ -1965,7 +1971,9 @@ VOID RtmpDrvAllMacPrint( } filp_close(file_w, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(orig_fs); +#endif os_free_mem(NULL, msg); } @@ -1987,8 +1995,10 @@ VOID RtmpDrvAllE2PPrint( if (!msg) return; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) orig_fs = get_fs(); set_fs(KERNEL_DS); +#endif /* open file */ file_w = filp_open(fileName, O_WRONLY | O_CREAT, 0); @@ -2017,7 +2027,9 @@ VOID RtmpDrvAllE2PPrint( } filp_close(file_w, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(orig_fs); +#endif os_free_mem(NULL, msg); } @@ -2031,8 +2043,10 @@ VOID RtmpDrvAllRFPrint( RTMP_STRING *fileName = "RFDump.txt"; mm_segment_t orig_fs; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) orig_fs = get_fs(); set_fs(KERNEL_DS); +#endif /* open file */ file_w = filp_open(fileName, O_WRONLY | O_CREAT, 0); @@ -2048,7 +2062,9 @@ VOID RtmpDrvAllRFPrint( } filp_close(file_w, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(orig_fs); +#endif } diff --git a/package/lean/mt/drivers/mt7603e/src/mt7603_wifi_ap/Kconfig b/package/lean/mt/drivers/mt7603e/src/mt7603_wifi_ap/Kconfig index bffacbbb2..ecfe63491 100644 --- a/package/lean/mt/drivers/mt7603e/src/mt7603_wifi_ap/Kconfig +++ b/package/lean/mt/drivers/mt7603e/src/mt7603_wifi_ap/Kconfig @@ -154,7 +154,7 @@ config MT7603E_SECURITY_IMPROVEMENT_SUPPORT bool "WPA2 security improvement support" depends on MT7603E_RLT_AP_SUPPORT default n - ---help--- + help WPA2 security improvement support @@ -164,7 +164,7 @@ config MT7603E_WPA3_SUPPORT select MT7603E_SECURITY_IMPROVEMENT_SUPPORT depends on MT7603E_RLT_AP_SUPPORT default n - ---help--- + help WPA3 support config MT7603E_OWE_SUPPORT @@ -172,12 +172,12 @@ config MT7603E_OWE_SUPPORT select MT7603E_DOT11W_PMF_SUPPORT depends on MT7603E_RLT_AP_SUPPORT default n - ---help--- + help Enhanced Open/OWE support config MT7603E_NEW_BW2040_COEXIST_SUPPORT bool "New BW20/40 Coexist support" depends on MT7603E_RLT_AP_SUPPORT default y - ---help--- + help Both Beacon and Radio fallback to BW20 for anti-interference diff --git a/package/lean/mt/drivers/mt7615d/src/mt_wifi/os/linux/rt_linux.c b/package/lean/mt/drivers/mt7615d/src/mt_wifi/os/linux/rt_linux.c index 871a45b2e..6600e29c6 100644 --- a/package/lean/mt/drivers/mt7615d/src/mt_wifi/os/linux/rt_linux.c +++ b/package/lean/mt/drivers/mt7615d/src/mt_wifi/os/linux/rt_linux.c @@ -865,10 +865,14 @@ static inline void __RtmpOSFSInfoChange(OS_FS_INFO *pOSFSInfo, BOOLEAN bSet) /* pOSFSInfo->fsgid = (int)(current_fsgid()); */ #endif #endif +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) pOSFSInfo->fs = get_fs(); set_fs(KERNEL_DS); +#endif } else { +#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0)) set_fs(pOSFSInfo->fs); +#endif #if (KERNEL_VERSION(2, 6, 29) > LINUX_VERSION_CODE) current->fsuid = pOSFSInfo->fsuid; current->fsgid = pOSFSInfo->fsgid; @@ -1925,8 +1929,10 @@ VOID RtmpDrvAllMacPrint( if (!msg) return; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) orig_fs = get_fs(); set_fs(KERNEL_DS); +#endif /* open file */ file_w = filp_open(fileName, O_WRONLY | O_CREAT, 0); @@ -1968,7 +1974,9 @@ VOID RtmpDrvAllMacPrint( filp_close(file_w, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(orig_fs); +#endif os_free_mem(msg); } @@ -1991,8 +1999,10 @@ VOID RtmpDrvAllE2PPrint( if (!msg) return; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) orig_fs = get_fs(); set_fs(KERNEL_DS); +#endif /* open file */ file_w = filp_open(fileName, O_WRONLY | O_CREAT, 0); @@ -2035,7 +2045,9 @@ VOID RtmpDrvAllE2PPrint( filp_close(file_w, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(orig_fs); +#endif os_free_mem(msg); } @@ -2049,8 +2061,10 @@ VOID RtmpDrvAllRFPrint( RTMP_STRING *fileName = "RFDump.txt"; mm_segment_t orig_fs; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) orig_fs = get_fs(); set_fs(KERNEL_DS); +#endif /* open file */ file_w = filp_open(fileName, O_WRONLY | O_CREAT, 0); @@ -2081,7 +2095,9 @@ VOID RtmpDrvAllRFPrint( filp_close(file_w, NULL); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) set_fs(orig_fs); +#endif }