Merge pull request #201 from CGarces/kernel_5.10

Fix Kernel compilation 5.10-rc1
This commit is contained in:
Carlos Garcés 2020-11-12 10:46:15 +01:00 committed by GitHub
commit 2ff6fb4f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 3 deletions

View File

@ -1443,7 +1443,9 @@ u8 rtw_btcoex_sendmsgbysocket(_adapter *padapter, u8 *msg, u8 msg_size, bool for
{
u8 error;
struct msghdr udpmsg;
#ifdef set_fs
mm_segment_t oldfs;
#endif
struct iovec iov;
struct bt_coex_info *pcoex_info = &padapter->coex_info;
@ -1473,15 +1475,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;
#ifdef set_fs
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
#ifdef set_fs
set_fs(oldfs);
#endif
if (error < 0) {
RTW_INFO("Error when sendimg msg, error:%d\n", error);
return _FAIL;

View File

@ -4744,7 +4744,9 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
int i = 0;
struct file *fp;
#ifdef set_fs
mm_segment_t fs;
#endif
loff_t pos = 0;
u8 *source = NULL;
long len = 0;
@ -4781,8 +4783,10 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
return 0;
}
#ifdef set_fs
fs = get_fs();
set_fs(KERNEL_DS);
#endif
source = rtw_zmalloc(2048);
@ -4792,7 +4796,9 @@ int rtw_dev_nlo_info_set(struct pno_nlo_info *nlo_info, pno_ssid_t *ssid,
rtw_mfree(source, 2048);
}
#ifdef set_fs
set_fs(fs);
#endif
filp_close(fp, NULL);
RTW_INFO("-%s-\n", __func__);

View File

@ -3983,7 +3983,9 @@ static int route_dump(u32 *gw_addr , int *gw_index)
struct msghdr msg;
struct iovec iov;
struct sockaddr_nl nladdr;
#ifdef set_fs
mm_segment_t oldfs;
#endif
char *pg;
int size = 0;
@ -4022,14 +4024,18 @@ static int route_dump(u32 *gw_addr , int *gw_index)
msg.msg_controllen = 0;
msg.msg_flags = MSG_DONTWAIT;
#ifdef set_fs
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
err = sock_sendmsg(sock, &msg);
#else
err = sock_sendmsg(sock, &msg, sizeof(req));
#endif
#ifdef set_fs
set_fs(oldfs);
#endif
if (err < 0)
goto out_sock;
@ -4054,15 +4060,18 @@ restart:
iov_iter_init(&msg.msg_iter, READ, &iov, 1, PAGE_SIZE);
#endif
#ifdef set_fs
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0))
err = sock_recvmsg(sock, &msg, MSG_DONTWAIT);
#else
err = sock_recvmsg(sock, &msg, PAGE_SIZE, MSG_DONTWAIT);
#endif
#ifdef set_fs
set_fs(oldfs);
#endif
if (err < 0)
goto out_sock_pg;
@ -4132,14 +4141,18 @@ done:
msg.msg_controllen = 0;
msg.msg_flags = MSG_DONTWAIT;
#ifdef set_fs
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 0))
err = sock_sendmsg(sock, &msg);
#else
err = sock_sendmsg(sock, &msg, sizeof(req));
#endif
#ifdef set_fs
set_fs(oldfs);
#endif
if (err > 0)
goto restart;

View File

@ -2193,16 +2193,19 @@ static int isFileReadable(const char *path, u32 *sz)
{
struct file *fp;
int ret = 0;
#ifdef set_fs
mm_segment_t oldfs;
#endif
char buf;
fp = filp_open(path, O_RDONLY, 0);
if (IS_ERR(fp))
ret = PTR_ERR(fp);
else {
#ifdef set_fs
oldfs = get_fs();
set_fs(KERNEL_DS);
#endif
if (1 != readFile(fp, &buf, 1))
ret = PTR_ERR(fp);
@ -2214,7 +2217,9 @@ static int isFileReadable(const char *path, u32 *sz)
#endif
}
#ifdef set_fs
set_fs(oldfs);
#endif
filp_close(fp, NULL);
}
return ret;
@ -2230,7 +2235,9 @@ static int isFileReadable(const char *path, u32 *sz)
static int retriveFromFile(const char *path, u8 *buf, u32 sz)
{
int ret = -1;
#ifdef set_fs
mm_segment_t oldfs;
#endif
struct file *fp;
if (path && buf) {
@ -2238,10 +2245,14 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
#ifdef set_fs
oldfs = get_fs();
set_fs(KERNEL_DS);
ret = readFile(fp, buf, sz);
set_fs(oldfs);
#else
ret = readFile(fp, buf, sz);
#endif
closeFile(fp);
RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
@ -2265,7 +2276,9 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
static int storeToFile(const char *path, u8 *buf, u32 sz)
{
int ret = 0;
#ifdef set_fs
mm_segment_t oldfs;
#endif
struct file *fp;
if (path && buf) {
@ -2273,12 +2286,15 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
#ifdef set_fs
oldfs = get_fs();
set_fs(KERNEL_DS);
ret = writeFile(fp, buf, sz);
set_fs(oldfs);
#else
ret = writeFile(fp, buf, sz);
#endif
closeFile(fp);
RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);
} else