Merge pull request #263 from heitbaum/517

rtl8192eu: Fix code for kernel 5.17 API change
This commit is contained in:
Carlos Garcés 2022-03-13 12:17:17 +01:00 committed by GitHub
commit 73663d2bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 0 deletions

View File

@ -1355,7 +1355,11 @@ exit:
pmptx->pallocated_buf = NULL; pmptx->pallocated_buf = NULL;
pmptx->stop = 1; pmptx->stop = 1;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
thread_exit(NULL); thread_exit(NULL);
#else
kthread_thread_exit(NULL);
#endif
return 0; return 0;
} }

View File

@ -315,7 +315,11 @@ static __inline void thread_enter(char *name)
allow_signal(SIGTERM); allow_signal(SIGTERM);
#endif #endif
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
void thread_exit(_completion *comp); void thread_exit(_completion *comp);
#else
void kthread_thread_exit(_completion *comp);
#endif
void _rtw_init_completion(_completion *comp); void _rtw_init_completion(_completion *comp);
void _rtw_wait_for_comp_timeout(_completion *comp); void _rtw_wait_for_comp_timeout(_completion *comp);
void _rtw_wait_for_comp(_completion *comp); void _rtw_wait_for_comp(_completion *comp);

View File

@ -11742,7 +11742,11 @@ thread_return lbk_thread(thread_context context)
ploopback->bstop = _TRUE; ploopback->bstop = _TRUE;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
thread_exit(NULL); thread_exit(NULL);
#else
kthread_thread_exit(NULL);
#endif
return 0; return 0;
} }

View File

@ -211,7 +211,11 @@ const int drv_proc_hdls_num = sizeof(drv_proc_hdls) / sizeof(struct rtw_proc_hdl
static int rtw_drv_proc_open(struct inode *inode, struct file *file) static int rtw_drv_proc_open(struct inode *inode, struct file *file)
{ {
/* struct net_device *dev = proc_get_parent_data(inode); */ /* 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); ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)inode->i_private;
#endif
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index; const struct rtw_proc_hdl *hdl = drv_proc_hdls + index;
void *private = NULL; void *private = NULL;
@ -233,7 +237,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) 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)); ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)file_inode(file)->i_private;
#endif
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index; 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; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
@ -4137,7 +4145,11 @@ const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_
static int rtw_adapter_proc_open(struct inode *inode, struct file *file) 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); ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)inode->i_private;
#endif
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index; const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index;
void *private = proc_get_parent_data(inode); void *private = proc_get_parent_data(inode);
@ -4159,7 +4171,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) 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)); ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)file_inode(file)->i_private;
#endif
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index; 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; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
@ -4324,7 +4340,11 @@ const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_proc_hdl
static int rtw_odm_proc_open(struct inode *inode, struct file *file) 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); ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)inode->i_private;
#endif
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index; const struct rtw_proc_hdl *hdl = odm_proc_hdls + index;
void *private = proc_get_parent_data(inode); void *private = proc_get_parent_data(inode);
@ -4346,7 +4366,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) 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)); ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)file_inode(file)->i_private;
#endif
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index; 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; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
@ -4483,7 +4507,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) 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); ssize_t index = (ssize_t)PDE_DATA(inode);
#else
ssize_t index = (ssize_t)inode->i_private;
#endif
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index; const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index;
void *private = proc_get_parent_data(inode); void *private = proc_get_parent_data(inode);
@ -4505,7 +4533,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) 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)); ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
#else
ssize_t index = (ssize_t)file_inode(file)->i_private;
#endif
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index; 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; ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;

View File

@ -872,10 +872,18 @@ u32 _rtw_down_sema(_sema *sema)
} }
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
inline void thread_exit(_completion *comp) inline void thread_exit(_completion *comp)
#else
inline void kthread_thread_exit(_completion *comp)
#endif
{ {
#ifdef PLATFORM_LINUX #ifdef PLATFORM_LINUX
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
complete_and_exit(comp, 0); complete_and_exit(comp, 0);
#else
kthread_complete_and_exit(comp, 0);
#endif
#endif #endif
} }