diff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c index 840a675..f1016e1 100644 --- a/os_dep/linux/rtw_proc.c +++ b/os_dep/linux/rtw_proc.c @@ -213,11 +213,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; @@ -239,11 +235,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; @@ -4163,11 +4155,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); @@ -4189,11 +4177,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; @@ -4358,11 +4342,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); @@ -4384,11 +4364,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; @@ -4525,11 +4501,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); @@ -4551,11 +4523,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; diff --git a/os_dep/linux/rtw_proc.h b/os_dep/linux/rtw_proc.h index c2c7c8e..af6f22f 100644 --- a/os_dep/linux/rtw_proc.h +++ b/os_dep/linux/rtw_proc.h @@ -17,6 +17,9 @@ #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) +#define PDE_DATA pde_data +#endif #define RTW_PROC_HDL_TYPE_SEQ 0 #define RTW_PROC_HDL_TYPE_SSEQ 1