From 1944ad78cec0ab812032b7537550bc405ea9cdbe Mon Sep 17 00:00:00 2001 From: Larry Finger Date: Wed, 26 Jan 2022 13:05:08 -0600 Subject: [PATCH] rtl8188eu: Fix build with kernel 5.17 Signed-off-by: Larry Finger --- hal_usb.c | 2 +- ioctl_linux.c | 2 +- os_intfs.c | 4 ++-- osdep_service.c | 2 +- osdep_service_linux.h | 4 ++++ rtl8188eu_xmit.c | 2 +- rtw_proc.c | 32 ++++++++++++++++++++++++++++++++ 7 files changed, 42 insertions(+), 6 deletions(-) diff --git a/hal_usb.c b/hal_usb.c index db07579..e8e64fb 100644 --- a/hal_usb.c +++ b/hal_usb.c @@ -13,7 +13,7 @@ int usb_init_recv_priv(_adapter *padapter, u16 ini_in_buf_sz) struct recv_buf *precvbuf; tasklet_init(&precvpriv->recv_tasklet, - (void(*)(unsigned long))usb_recv_tasklet, + (void(*))usb_recv_tasklet, (unsigned long)padapter); #ifdef CONFIG_USB_INTERRUPT_IN_PIPE diff --git a/ioctl_linux.c b/ioctl_linux.c index ab845a9..ed6f8fd 100644 --- a/ioctl_linux.c +++ b/ioctl_linux.c @@ -9418,7 +9418,7 @@ static int rtw_mp_efuse_set(struct net_device *dev, rtw_hal_read_chip_info(padapter); /* set mac addr*/ rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter)); - memcpy(padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */ + memcpy((void *)padapter->pnetdev->dev_addr, get_hal_mac_addr(padapter), ETH_ALEN); /* set mac addr to net_device */ #ifdef CONFIG_P2P rtw_init_wifidirect_addrs(padapter, adapter_mac_addr(padapter), adapter_mac_addr(padapter)); diff --git a/os_intfs.c b/os_intfs.c index 585ce4a..f8c5ed7 100644 --- a/os_intfs.c +++ b/os_intfs.c @@ -946,7 +946,7 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr) } memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */ - memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */ + memcpy((void *)pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */ rtw_ps_deny(padapter, PS_DENY_IOCTL); LeaveAllPowerSaveModeDirect(padapter); /* leave PS mode for guaranteeing to access hw register successfully */ @@ -1329,7 +1329,7 @@ static int rtw_os_ndev_register(_adapter *adapter, const char *name) /* alloc netdev name */ rtw_init_netdev_name(ndev, name); - memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); + memcpy((void *)ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN); /* Tell the network stack we exist */ diff --git a/osdep_service.c b/osdep_service.c index 9132038..0388a1c 100644 --- a/osdep_service.c +++ b/osdep_service.c @@ -1367,7 +1367,7 @@ int rtw_change_ifname(_adapter *padapter, const char *ifname) rtw_init_netdev_name(pnetdev, ifname); - memcpy(pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); + memcpy((void *)pnetdev->dev_addr, adapter_mac_addr(padapter), ETH_ALEN); if (rtnl_lock_needed) ret = register_netdev(pnetdev); diff --git a/osdep_service_linux.h b/osdep_service_linux.h index 7826e79..400af47 100644 --- a/osdep_service_linux.h +++ b/osdep_service_linux.h @@ -153,7 +153,11 @@ typedef void *_thread_hdl_; typedef int thread_return; typedef void *thread_context; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) #define thread_exit() complete_and_exit(NULL, 0) +#else +#define thread_exit() kthread_complete_and_exit(NULL, 0) +#endif typedef void timer_hdl_return; typedef void *timer_hdl_context; diff --git a/rtl8188eu_xmit.c b/rtl8188eu_xmit.c index ed9a5fa..64da712 100644 --- a/rtl8188eu_xmit.c +++ b/rtl8188eu_xmit.c @@ -13,7 +13,7 @@ s32 rtl8188eu_init_xmit_priv(_adapter *padapter) HAL_DATA_TYPE *pHalData = GET_HAL_DATA(padapter); tasklet_init(&pxmitpriv->xmit_tasklet, - (void(*)(unsigned long))rtl8188eu_xmit_tasklet, + (void(*))rtl8188eu_xmit_tasklet, (unsigned long)padapter); #ifdef CONFIG_TX_EARLY_MODE pHalData->bEarlyModeEnable = padapter->registrypriv.early_mode; diff --git a/rtw_proc.c b/rtw_proc.c index cdf24a2..600d5ff 100644 --- a/rtw_proc.c +++ b/rtw_proc.c @@ -178,7 +178,11 @@ static const int drv_proc_hdls_num = sizeof(drv_proc_hdls) / sizeof(struct rtw_p static int rtw_drv_proc_open(struct inode *inode, struct file *file) { /* struct net_device *dev = proc_get_parent_data(inode); */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(inode); +#else + ssize_t index = (ssize_t)pde_data(inode); +#endif const struct rtw_proc_hdl *hdl = drv_proc_hdls + index; void *private = NULL; @@ -200,7 +204,11 @@ static int rtw_drv_proc_open(struct inode *inode, struct file *file) static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(file_inode(file)); +#else + ssize_t index = (ssize_t)pde_data(file_inode(file)); +#endif const struct rtw_proc_hdl *hdl = drv_proc_hdls + index; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write; @@ -2511,7 +2519,11 @@ static const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(stru static int rtw_adapter_proc_open(struct inode *inode, struct file *file) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(inode); +#else + ssize_t index = (ssize_t)pde_data(inode); +#endif const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index; void *private = proc_get_parent_data(inode); @@ -2533,7 +2545,11 @@ static int rtw_adapter_proc_open(struct inode *inode, struct file *file) static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(file_inode(file)); +#else + ssize_t index = (ssize_t)pde_data(file_inode(file)); +#endif const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write; @@ -2829,7 +2845,11 @@ static const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_p static int rtw_odm_proc_open(struct inode *inode, struct file *file) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(inode); +#else + ssize_t index = (ssize_t)pde_data(inode); +#endif const struct rtw_proc_hdl *hdl = odm_proc_hdls + index; void *private = proc_get_parent_data(inode); @@ -2851,7 +2871,11 @@ static int rtw_odm_proc_open(struct inode *inode, struct file *file) static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(file_inode(file)); +#else + ssize_t index = (ssize_t)pde_data(file_inode(file)); +#endif const struct rtw_proc_hdl *hdl = odm_proc_hdls + index; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write; @@ -2989,7 +3013,11 @@ const int mcc_proc_hdls_num = sizeof(mcc_proc_hdls) / sizeof(struct rtw_proc_hdl static int rtw_mcc_proc_open(struct inode *inode, struct file *file) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(inode); +#else + ssize_t index = (ssize_t)pde_data(inode); +#endif const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index; void *private = proc_get_parent_data(inode); @@ -3011,7 +3039,11 @@ static int rtw_mcc_proc_open(struct inode *inode, struct file *file) static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0) ssize_t index = (ssize_t)PDE_DATA(file_inode(file)); +#else + ssize_t index = (ssize_t)pde_data(file_inode(file)); +#endif const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;