--- a/include/osdep_service_linux.h
+++ b/include/osdep_service_linux.h
@@ -220,7 +220,7 @@ typedef void *timer_hdl_context;
 	#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
 #endif
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0) && !defined(BUILD_OPENWRT))
 /* Porting from linux kernel commits 
 48eab831ae8b9f7002a533fa4235eed63ea1f1a3 
 3f6cffb8604b537e3d7ea040d7f4368689638eaf
--- a/os_dep/linux/ioctl_cfg80211.c
+++ b/os_dep/linux/ioctl_cfg80211.c
@@ -438,7 +438,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapte
 	ret = rtw_chbw_to_cfg80211_chan_def(wiphy, &chdef, ch, bw, offset, ht);
 	if (ret != _SUCCESS)
 		goto exit;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2) || defined(BUILD_OPENWRT))
 	cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
 #else
 	cfg80211_ch_switch_notify(adapter->pnetdev, &chdef);
@@ -1112,7 +1112,7 @@ check_bss:
 		#endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || defined(BUILD_OPENWRT))
 		roam_info.links[0].bssid = cur_network->network.MacAddress;
 #else
 		roam_info.bssid = cur_network->network.MacAddress;
@@ -1679,7 +1679,7 @@ exit:
 }
 
 static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(BUILD_OPENWRT))
 	,int link_id
 #endif
 	, u8 key_index
@@ -1826,7 +1826,7 @@ addkey_end:
 }
 
 static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(BUILD_OPENWRT))
 	,int link_id
 #endif
 	, u8 keyid
@@ -1994,7 +1994,7 @@ exit:
 }
 
 static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(BUILD_OPENWRT))
 	int link_id,
 #endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
@@ -2018,7 +2018,7 @@ static int cfg80211_rtw_del_key(struct w
 
 static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
 	struct net_device *ndev, 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(BUILD_OPENWRT))
 	int link_id,
 #endif	 	
 	u8 key_index
@@ -2070,7 +2070,7 @@ static int cfg80211_rtw_set_default_key(
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
 int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
 	struct net_device *ndev, 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) || defined(BUILD_OPENWRT))
 	int link_id,
 #endif	
 	u8 key_index)
@@ -5158,7 +5158,7 @@ static int cfg80211_rtw_change_beacon(st
 
 	return ret;
 }
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2) || defined(BUILD_OPENWRT))
 static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
 #else
 static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
@@ -7609,7 +7609,7 @@ static void cfg80211_rtw_mgmt_frame_regi
 #else
 	struct net_device *ndev,
 #endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) || defined(BUILD_OPENWRT))
 	struct mgmt_frame_regs *upd)
 #else
 	u16 frame_type, bool reg)
@@ -7619,7 +7619,7 @@ static void cfg80211_rtw_mgmt_frame_regi
 	struct net_device *ndev = wdev_to_ndev(wdev);
 #endif
 	_adapter *adapter;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) || defined(BUILD_OPENWRT))
 	u16 frame_type = BIT(upd->global_stypes << 4);
 	bool reg = false;
 #endif
@@ -10047,7 +10047,7 @@ static struct cfg80211_ops rtw_cfg80211_
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) && LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 35))
 	.action = cfg80211_rtw_mgmt_tx,
 #endif
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) || defined(BUILD_OPENWRT))
 	.update_mgmt_frame_registrations = cfg80211_rtw_mgmt_frame_register,
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
 	.mgmt_frame_register = cfg80211_rtw_mgmt_frame_register,
@@ -10261,7 +10261,7 @@ void rtw_wdev_unregister(struct wireless
 	rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
 
 	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
-	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2))
+	#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,19, 2) || defined(BUILD_OPENWRT))
 	if (wdev->connected) {
 	#else
 	if (wdev->current_bss) {
