From 49e792766bd95c9dcd37772fe1e3929dcf12b753 Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Wed, 16 Oct 2019 11:47:29 -0500 Subject: [PATCH] rtl8188eu: Fix build for kernel 5.0 and newer Signed-off-by: Larry Finger --- core/rtw_mlme_ext.c | 2 +- hal/usb_halinit.c | 1 + os_dep/os_intfs.c | 18 ++++++++++-------- os_dep/osdep_service.c | 10 +++------- os_dep/rtw_android.c | 7 ++++++- os_dep/usb_intf.c | 2 +- 6 files changed, 22 insertions(+), 18 deletions(-) diff --git a/core/rtw_mlme_ext.c b/core/rtw_mlme_ext.c index 9d72cfd..fca3866 100644 --- a/core/rtw_mlme_ext.c +++ b/core/rtw_mlme_ext.c @@ -626,7 +626,7 @@ void mgt_dispatcher(struct adapter *padapter, union recv_frame *precv_frame) ptable->func = &OnAuth; else ptable->func = &OnAuthClient; - /* pass through */ + __attribute__((__fallthrough__)); case WIFI_ASSOCREQ: case WIFI_REASSOCREQ: _mgt_dispatcher(padapter, ptable, precv_frame); diff --git a/hal/usb_halinit.c b/hal/usb_halinit.c index 7250685..9a8c69f 100644 --- a/hal/usb_halinit.c +++ b/hal/usb_halinit.c @@ -2863,6 +2863,7 @@ static void GetHwReg8188EU(struct adapter *Adapter, u8 variable, u8* val) { case HW_VAR_BASIC_RATE: *((u16 *)(val)) = pHalData->BasicRateSet; + __attribute__ ((__fallthrough__)); case HW_VAR_TXPAUSE: val[0] = rtw_read8(Adapter, REG_TXPAUSE); break; diff --git a/os_dep/os_intfs.c b/os_dep/os_intfs.c index 1484382..e9ed317 100644 --- a/os_dep/os_intfs.c +++ b/os_dep/os_intfs.c @@ -413,15 +413,17 @@ static unsigned int rtw_classify8021d(struct sk_buff *skb) return dscp >> 5; } -static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) - ,struct net_device *sb_dev - ,select_queue_fallback_t fallback +static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)) + struct net_device *sb_dev +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) + struct net_device *sb_dev, + select_queue_fallback_t fallback #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) - ,void *unused - ,select_queue_fallback_t fallback -#elif (LINUX_VERSION_CODE == KERNEL_VERSION(3, 13, 0)) - , void *accel + void *unused, + select_queue_fallback_t fallback +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 13, 0) + void *accel_priv #endif ) { diff --git a/os_dep/osdep_service.c b/os_dep/osdep_service.c index e6cec97..ad7a7f3 100644 --- a/os_dep/osdep_service.c +++ b/os_dep/osdep_service.c @@ -913,7 +913,7 @@ static int isFileReadable(char *path) ret = PTR_ERR(fp); } else { - oldfs = get_fs(); set_fs(get_ds()); + oldfs = get_fs(); set_fs(KERNEL_DS); if (1!=readFile(fp, &buf, 1)) ret = PTR_ERR(fp); @@ -934,16 +934,14 @@ static int isFileReadable(char *path) static int retriveFromFile(char *path, u8* buf, u32 sz) { int ret =-1; - mm_segment_t oldfs; struct file *fp; if (path && buf) { if ( 0 == (ret=openFile(&fp,path, O_RDONLY, 0)) ) { DBG_88E("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); - oldfs = get_fs(); set_fs(get_ds()); + set_fs(KERNEL_DS); ret=readFile(fp, buf, sz); - set_fs(oldfs); closeFile(fp); DBG_88E("%s readFile, ret:%d\n",__FUNCTION__, ret); @@ -968,16 +966,14 @@ static int retriveFromFile(char *path, u8* buf, u32 sz) static int storeToFile(char *path, u8* buf, u32 sz) { int ret =0; - mm_segment_t oldfs; struct file *fp; if (path && buf) { if ( 0 == (ret=openFile(&fp, path, O_CREAT|O_WRONLY, 0666)) ) { DBG_88E("%s openFile path:%s fp=%p\n",__FUNCTION__, path ,fp); - oldfs = get_fs(); set_fs(get_ds()); + set_fs(KERNEL_DS); ret=writeFile(fp, buf, sz); - set_fs(oldfs); closeFile(fp); DBG_88E("%s writeFile, ret:%d\n",__FUNCTION__, ret); diff --git a/os_dep/rtw_android.c b/os_dep/rtw_android.c index 14f0510..ec62ddf 100644 --- a/os_dep/rtw_android.c +++ b/os_dep/rtw_android.c @@ -356,7 +356,12 @@ int rtw_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd) goto exit; } - if (!access_ok(VERIFY_READ, (const void __user *)priv_cmd.buf, priv_cmd.total_len)) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)) + if (!access_ok(priv_cmd.buf, priv_cmd.total_len)) { +#else + if (!access_ok(VERIFY_READ, (const void __user *)priv_cmd.buf, + priv_cmd.total_len)) { +#endif DBG_88E("%s: failed to access memory\n", __FUNCTION__); ret = -EFAULT; goto exit; diff --git a/os_dep/usb_intf.c b/os_dep/usb_intf.c index 1cbb9ab..76619c5 100644 --- a/os_dep/usb_intf.c +++ b/os_dep/usb_intf.c @@ -127,7 +127,7 @@ static void rtw_dev_shutdown(struct device *dev) {USB_DEVICE(0x2001, 0x3310)}, /* Dlink DWA-123 REV D1 */ \ {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ \ {USB_DEVICE(0x056E, 0x4008)}, /* Elecom WDC-150SU2M */ \ - {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ + {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ \ {USB_DEVICE(0x2357, 0x0111)}, /* TP-Link TL-WN727N v5.21 */ static struct usb_device_id rtw_usb_id_tbl[] ={