Linux 5.10 compat: remove set_fs()

This commit is contained in:
Rin Cat
2020-11-19 19:56:00 -05:00
parent 61a2ab6ce4
commit 64d833c13d
4 changed files with 44 additions and 0 deletions

View File

@@ -1468,7 +1468,9 @@ u8 rtw_btcoex_sendmsgbysocket(_adapter *padapter, u8 *msg, u8 msg_size, bool for
{
u8 error;
struct msghdr udpmsg;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
mm_segment_t oldfs;
#endif
struct iovec iov;
struct bt_coex_info *pcoex_info = &padapter->coex_info;
@@ -1498,15 +1500,19 @@ u8 rtw_btcoex_sendmsgbysocket(_adapter *padapter, u8 *msg, u8 msg_size, bool for
udpmsg.msg_control = NULL;
udpmsg.msg_controllen = 0;
udpmsg.msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
error = sock_sendmsg(pcoex_info->udpsock, &udpmsg);
#else
error = sock_sendmsg(pcoex_info->udpsock, &udpmsg, msg_size);
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(oldfs);
#endif
if (error < 0) {
RTW_INFO("Error when sendimg msg, error:%d\n", error);
return _FAIL;

View File

@@ -4799,7 +4799,9 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
int i = 0;
struct file *fp;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
mm_segment_t fs;
#endif
loff_t pos = 0;
u8 *source = NULL;
long len = 0;
@@ -4836,8 +4838,10 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
return 0;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
fs = get_fs();
set_fs(KERNEL_DS);
#endif
source = rtw_zmalloc(2048);
@@ -4847,7 +4851,9 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
rtw_mfree(source, 2048);
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0))
set_fs(fs);
#endif
filp_close(fp, NULL);
RTW_INFO("-%s-\n", __func__);