mirror of
https://github.com/Mange/rtl8192eu-linux-driver
synced 2025-12-10 00:04:17 +00:00
Simplify 5.17 patch
This commit is contained in:
@@ -34,6 +34,10 @@ inline struct proc_dir_entry *get_rtw_drv_proc(void)
|
||||
#define file_inode(file) ((file)->f_dentry->d_inode)
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17,0))
|
||||
#define PDE_DATA(inode) pde_data(inode)
|
||||
#endif
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
|
||||
#define PDE_DATA(inode) PDE((inode))->data
|
||||
#define proc_get_parent_data(inode) PDE((inode))->parent->data
|
||||
@@ -211,11 +215,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); */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
|
||||
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;
|
||||
void *private = NULL;
|
||||
|
||||
@@ -237,11 +237,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)
|
||||
{
|
||||
#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)file_inode(file)->i_private;
|
||||
#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;
|
||||
|
||||
@@ -4145,11 +4141,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)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
|
||||
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;
|
||||
void *private = proc_get_parent_data(inode);
|
||||
|
||||
@@ -4171,11 +4163,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)
|
||||
{
|
||||
#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)file_inode(file)->i_private;
|
||||
#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;
|
||||
|
||||
@@ -4340,11 +4328,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)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
|
||||
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;
|
||||
void *private = proc_get_parent_data(inode);
|
||||
|
||||
@@ -4366,11 +4350,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)
|
||||
{
|
||||
#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)file_inode(file)->i_private;
|
||||
#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;
|
||||
|
||||
@@ -4507,11 +4487,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)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 17, 0)
|
||||
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;
|
||||
void *private = proc_get_parent_data(inode);
|
||||
|
||||
@@ -4533,11 +4509,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)
|
||||
{
|
||||
#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)file_inode(file)->i_private;
|
||||
#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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user