mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2024-12-01 16:33:41 +00:00
rtl8188eu: Fix builds for old and new kernels
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
8118ea20d7
commit
99a60df1f5
3 changed files with 12 additions and 2 deletions
|
@ -416,7 +416,7 @@ static unsigned int rtw_classify8021d(struct sk_buff *skb)
|
||||||
static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
|
static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0))
|
||||||
struct net_device *sb_dev
|
struct net_device *sb_dev
|
||||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0))
|
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0))
|
||||||
struct net_device *sb_dev,
|
struct net_device *sb_dev,
|
||||||
select_queue_fallback_t fallback
|
select_queue_fallback_t fallback
|
||||||
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
|
#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0))
|
||||||
|
|
|
@ -905,7 +905,9 @@ static int isFileReadable(char *path)
|
||||||
{
|
{
|
||||||
struct file *fp;
|
struct file *fp;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
#ifdef set_fs
|
||||||
mm_segment_t oldfs;
|
mm_segment_t oldfs;
|
||||||
|
#endif
|
||||||
char buf;
|
char buf;
|
||||||
|
|
||||||
fp=filp_open(path, O_RDONLY, 0);
|
fp=filp_open(path, O_RDONLY, 0);
|
||||||
|
@ -913,12 +915,16 @@ static int isFileReadable(char *path)
|
||||||
ret = PTR_ERR(fp);
|
ret = PTR_ERR(fp);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
#ifdef set_fs
|
||||||
oldfs = get_fs(); set_fs(KERNEL_DS);
|
oldfs = get_fs(); set_fs(KERNEL_DS);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (1!=readFile(fp, &buf, 1))
|
if (1!=readFile(fp, &buf, 1))
|
||||||
ret = PTR_ERR(fp);
|
ret = PTR_ERR(fp);
|
||||||
|
|
||||||
|
#ifdef set_fs
|
||||||
set_fs(oldfs);
|
set_fs(oldfs);
|
||||||
|
#endif
|
||||||
filp_close(fp,NULL);
|
filp_close(fp,NULL);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -940,7 +946,9 @@ static int retriveFromFile(char *path, u8* buf, u32 sz)
|
||||||
if ( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ) {
|
if ( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ) {
|
||||||
DBG_88E("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
DBG_88E("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||||
|
|
||||||
|
#ifdef set_fs
|
||||||
set_fs(KERNEL_DS);
|
set_fs(KERNEL_DS);
|
||||||
|
#endif
|
||||||
ret=readFile(fp, buf, sz);
|
ret=readFile(fp, buf, sz);
|
||||||
closeFile(fp);
|
closeFile(fp);
|
||||||
|
|
||||||
|
@ -972,7 +980,9 @@ static int storeToFile(char *path, u8* buf, u32 sz)
|
||||||
if ( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
|
if ( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) {
|
||||||
DBG_88E("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
DBG_88E("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp);
|
||||||
|
|
||||||
|
#ifdef set_fs
|
||||||
set_fs(KERNEL_DS);
|
set_fs(KERNEL_DS);
|
||||||
|
#endif
|
||||||
ret=writeFile(fp, buf, sz);
|
ret=writeFile(fp, buf, sz);
|
||||||
closeFile(fp);
|
closeFile(fp);
|
||||||
|
|
||||||
|
|
|
@ -356,7 +356,7 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0))
|
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0))
|
||||||
if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) {
|
if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) {
|
||||||
#else
|
#else
|
||||||
if (!access_ok(VERIFY_READ, (const void __user *)priv_cmd.buf,
|
if (!access_ok(VERIFY_READ, (const void __user *)priv_cmd.buf,
|
||||||
|
|
Loading…
Reference in a new issue