Merge pull request #127 from weimzh/master

Linux 5.17
This commit is contained in:
Rin Cat (鈴猫) 2022-03-01 00:56:43 -05:00 committed by GitHub
commit aacd0d5c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 11 deletions

View File

@ -1,6 +1,6 @@
# REALTEK RTL88x2B USB Linux Driver
**Current Driver Version**: 5.13.1
**Support Kernel**: 2.6.24 ~ 5.16 (with unofficial patches)
**Support Kernel**: 2.6.24 ~ 5.17 (with unofficial patches)
Official release note please check ReleaseNotes.pdf

View File

@ -35,8 +35,10 @@ inline struct proc_dir_entry *get_rtw_drv_proc(void)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
#define PDE_DATA(inode) PDE((inode))->data
#define pde_data(inode) PDE((inode))->data
#define proc_get_parent_data(inode) PDE((inode))->parent->data
#elif (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
#define pde_data(inode) PDE_DATA(inode)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
@ -247,7 +249,7 @@ 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)
{
/* struct net_device *dev = proc_get_parent_data(inode); */
ssize_t index = (ssize_t)PDE_DATA(inode);
ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index;
void *private = NULL;
@ -273,7 +275,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
ssize_t index = (ssize_t)pde_data(file_inode(file));
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;
@ -5688,7 +5690,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(inode);
ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index;
void *private = proc_get_parent_data(inode);
@ -5714,7 +5716,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
ssize_t index = (ssize_t)pde_data(file_inode(file));
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;
@ -5877,7 +5879,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(inode);
ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index;
void *private = proc_get_parent_data(inode);
@ -5903,7 +5905,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
ssize_t index = (ssize_t)pde_data(file_inode(file));
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;
@ -6042,7 +6044,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(inode);
ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index;
void *private = proc_get_parent_data(inode);
@ -6068,7 +6070,7 @@ 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)
{
ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
ssize_t index = (ssize_t)pde_data(file_inode(file));
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;

View File

@ -17,6 +17,11 @@
#define _OSDEP_SERVICE_C_
#include <drv_types.h>
#include <linux/kthread.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0))
#define kthread_complete_and_exit(comp, code) complete_and_exit(comp, code)
#endif
#define RT_TAG '1178'
@ -1309,7 +1314,7 @@ u32 _rtw_down_sema(_sema *sema)
inline void thread_exit(_completion *comp)
{
#ifdef PLATFORM_LINUX
complete_and_exit(comp, 0);
kthread_complete_and_exit(comp, 0);
#endif
#ifdef PLATFORM_FREEBSD