blob: 607d00d604146f6280cf22bbe890c7d51bd84a7c [file] [log] [blame]
From d3bd26812728c9ac2249ea29bda674dd31034ac6 Mon Sep 17 00:00:00 2001
From: Christian Stewart <christian@paral.in>
Date: Tue, 8 Sep 2020 23:08:39 -0700
Subject: [PATCH] rtw_proc: convert file_operations to proc_ops for 5.6.x
compat
Signed-off-by: Christian Stewart <christian@paral.in>
---
os_dep/linux/rtw_proc.c | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c
index 048080a..d944649 100644
--- a/os_dep/linux/rtw_proc.c
+++ b/os_dep/linux/rtw_proc.c
@@ -65,9 +65,15 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_
}
inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
- const struct file_operations *fops, void * data)
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
+ const struct file_operations *fops,
+ #else
+ const struct proc_ops *fops,
+ #endif
+ void * data
+ )
{
- struct proc_dir_entry *entry;
+ struct proc_dir_entry *entry;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
entry = proc_create_data(name, S_IFREG|S_IRUGO|S_IWUGO, parent, fops, data);
@@ -167,6 +173,7 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_drv_proc_fops = {
.owner = THIS_MODULE,
.open = rtw_drv_proc_open,
@@ -174,7 +181,16 @@ static const struct file_operations rtw_drv_proc_fops = {
.llseek = seq_lseek,
.release = single_release,
.write = rtw_drv_proc_write,
+}
+#else
+static const struct proc_ops rtw_drv_proc_fops = {
+ .proc_open = rtw_drv_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = seq_release,
+ .proc_write = rtw_drv_proc_write,
};
+#endif
int rtw_drv_proc_init(void)
{
@@ -776,6 +792,7 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff
return -EROFS;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_adapter_proc_fops = {
.owner = THIS_MODULE,
.open = rtw_adapter_proc_open,
@@ -784,6 +801,15 @@ static const struct file_operations rtw_adapter_proc_fops = {
.release = single_release,
.write = rtw_adapter_proc_write,
};
+#else
+static const struct proc_ops rtw_adapter_proc_fops = {
+ .proc_open = rtw_adapter_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = rtw_adapter_proc_write,
+};
+#endif
int proc_get_odm_dbg_comp(struct seq_file *m, void *v)
{
@@ -1030,6 +1056,7 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer,
return -EROFS;
}
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
static const struct file_operations rtw_odm_proc_fops = {
.owner = THIS_MODULE,
.open = rtw_odm_proc_open,
@@ -1038,6 +1065,15 @@ static const struct file_operations rtw_odm_proc_fops = {
.release = single_release,
.write = rtw_odm_proc_write,
};
+#else
+static const struct proc_ops rtw_odm_proc_fops = {
+ .proc_open = rtw_odm_proc_open,
+ .proc_read = seq_read,
+ .proc_lseek = seq_lseek,
+ .proc_release = single_release,
+ .proc_write = rtw_odm_proc_write,
+};
+#endif
struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
{
--
2.28.0