rtl8821cu: fix build on kernel 4.9

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2022-05-27 16:55:46 +08:00
parent d73dca503c
commit bd501b42e7
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
2 changed files with 65 additions and 8 deletions

View File

@ -1,15 +1,11 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2021 ImmortalWrt
# <https://immortalwrt.org>
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
# Copyright (C) 2021-2022 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=rtl8821cu
PKG_RELEASE:=1
PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE_URL:=https://github.com/brektrou/rtl8821CU.git
PKG_SOURCE_PROTO:=git
@ -19,7 +15,7 @@ PKG_MIRROR_HASH:=77958d3bff8b0145504a10959765be0e3743b9c4880a5173d156238c2c569a5
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINTER:=CN_SZTL <cnsztl@immortalwrt.org>
PKG_MAINTAINTER:=Tianling Shen <cnsztl@immortalwrt.org>
PKG_BUILD_PARALLEL:=1

View File

@ -0,0 +1,61 @@
diff --git a/os_dep/linux/ioctl_cfg80211.c b/os_dep/linux/ioctl_cfg80211.c
index d9c81c9..0495ac3 100755
--- a/os_dep/linux/ioctl_cfg80211.c
+++ b/os_dep/linux/ioctl_cfg80211.c
@@ -1011,7 +1011,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
#ifdef CONFIG_P2P
struct wifidirect_info *pwdinfo = &(padapter->wdinfo);
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || LINUX_VERSION_IN_RANGE(4, 9, 255, 4, 10, 0)
struct cfg80211_roam_info roam_info ={};
#endif
@@ -1084,7 +1084,7 @@ check_bss:
notify_channel = ieee80211_get_channel(wiphy, freq);
#endif
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || LINUX_VERSION_IN_RANGE(4, 9, 255, 4, 10, 0)
roam_info.bssid = cur_network->network.MacAddress;
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
@@ -1103,7 +1103,7 @@ check_bss:
, pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6
, pmlmepriv->assoc_rsp_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 6
, GFP_ATOMIC);
- #endif /*LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)*/
+ #endif /*LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) || LINUX_VERSION_IN_RANGE(4, 9, 255, 4, 10, 0)*/
RTW_INFO(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter));
@@ -2276,7 +2276,8 @@ enum nl80211_iftype {
static int cfg80211_rtw_change_iface(struct wiphy *wiphy,
struct net_device *ndev,
enum nl80211_iftype type,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) && \
+ !LINUX_VERSION_IN_RANGE(4, 9, 255, 4, 10, 0)
u32 *flags,
#endif
struct vif_params *params)
@@ -4594,7 +4595,8 @@ static int
unsigned char name_assign_type,
#endif
enum nl80211_iftype type,
- #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) && \
+ !LINUX_VERSION_IN_RANGE(4, 9, 255, 4, 10, 0)
u32 *flags,
#endif
struct vif_params *params)
@@ -9150,7 +9152,8 @@ static void rtw_cfg80211_preinit_wiphy(_adapter *adapter, struct wiphy *wiphy)
#endif
#if defined(CONFIG_PM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) && \
- LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0))
+ LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)) && \
+ !LINUX_VERSION_IN_RANGE(4, 9, 255, 4, 10, 0)
wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
#ifdef CONFIG_PNO_SUPPORT
wiphy->max_sched_scan_ssids = MAX_PNO_LIST_COUNT;