1*4882a593SmuzhiyunFrom e0ed05200e6e4b86e26e092dc1f16fc8fc1e2b67 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Christian Stewart <christian@paral.in>
3*4882a593SmuzhiyunDate: Tue, 8 Sep 2020 23:08:39 -0700
4*4882a593SmuzhiyunSubject: [PATCH] rtw_proc: convert file_operations to proc_ops for 5.6.x
5*4882a593Smuzhiyun compat
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunSigned-off-by: Christian Stewart <christian@paral.in>
8*4882a593Smuzhiyun[Fix < 5.6.x compile - missing semicolon]
9*4882a593SmuzhiyunSigned-off-by: Peter Seiderer <ps.report@gmx.net>
10*4882a593Smuzhiyun---
11*4882a593Smuzhiyun os_dep/linux/rtw_proc.c | 40 ++++++++++++++++++++++++++++++++++++++--
12*4882a593Smuzhiyun 1 file changed, 38 insertions(+), 2 deletions(-)
13*4882a593Smuzhiyun
14*4882a593Smuzhiyundiff --git a/os_dep/linux/rtw_proc.c b/os_dep/linux/rtw_proc.c
15*4882a593Smuzhiyunindex 048080a..6295f66 100644
16*4882a593Smuzhiyun--- a/os_dep/linux/rtw_proc.c
17*4882a593Smuzhiyun+++ b/os_dep/linux/rtw_proc.c
18*4882a593Smuzhiyun@@ -65,9 +65,15 @@ inline struct proc_dir_entry *rtw_proc_create_dir(const char *name, struct proc_
19*4882a593Smuzhiyun }
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun inline struct proc_dir_entry *rtw_proc_create_entry(const char *name, struct proc_dir_entry *parent,
22*4882a593Smuzhiyun-        const struct file_operations *fops, void * data)
23*4882a593Smuzhiyun+	#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
24*4882a593Smuzhiyun+	const struct file_operations *fops,
25*4882a593Smuzhiyun+	#else
26*4882a593Smuzhiyun+	const struct proc_ops *fops,
27*4882a593Smuzhiyun+	#endif
28*4882a593Smuzhiyun+	void * data
29*4882a593Smuzhiyun+	)
30*4882a593Smuzhiyun {
31*4882a593Smuzhiyun-	struct proc_dir_entry *entry;
32*4882a593Smuzhiyun+        struct proc_dir_entry *entry;
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26))
35*4882a593Smuzhiyun 	entry = proc_create_data(name,  S_IFREG|S_IRUGO|S_IWUGO, parent, fops, data);
36*4882a593Smuzhiyun@@ -167,6 +173,7 @@ static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer,
37*4882a593Smuzhiyun 	return -EROFS;
38*4882a593Smuzhiyun }
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
41*4882a593Smuzhiyun static const struct file_operations rtw_drv_proc_fops = {
42*4882a593Smuzhiyun 	.owner = THIS_MODULE,
43*4882a593Smuzhiyun 	.open = rtw_drv_proc_open,
44*4882a593Smuzhiyun@@ -175,6 +182,15 @@ static const struct file_operations rtw_drv_proc_fops = {
45*4882a593Smuzhiyun 	.release = single_release,
46*4882a593Smuzhiyun 	.write = rtw_drv_proc_write,
47*4882a593Smuzhiyun };
48*4882a593Smuzhiyun+#else
49*4882a593Smuzhiyun+static const struct proc_ops rtw_drv_proc_fops = {
50*4882a593Smuzhiyun+	.proc_open = rtw_drv_proc_open,
51*4882a593Smuzhiyun+	.proc_read = seq_read,
52*4882a593Smuzhiyun+	.proc_lseek = seq_lseek,
53*4882a593Smuzhiyun+	.proc_release = seq_release,
54*4882a593Smuzhiyun+	.proc_write = rtw_drv_proc_write,
55*4882a593Smuzhiyun+};
56*4882a593Smuzhiyun+#endif
57*4882a593Smuzhiyun
58*4882a593Smuzhiyun int rtw_drv_proc_init(void)
59*4882a593Smuzhiyun {
60*4882a593Smuzhiyun@@ -776,6 +792,7 @@ static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buff
61*4882a593Smuzhiyun 	return -EROFS;
62*4882a593Smuzhiyun }
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
65*4882a593Smuzhiyun static const struct file_operations rtw_adapter_proc_fops = {
66*4882a593Smuzhiyun 	.owner = THIS_MODULE,
67*4882a593Smuzhiyun 	.open = rtw_adapter_proc_open,
68*4882a593Smuzhiyun@@ -784,6 +801,15 @@ static const struct file_operations rtw_adapter_proc_fops = {
69*4882a593Smuzhiyun 	.release = single_release,
70*4882a593Smuzhiyun 	.write = rtw_adapter_proc_write,
71*4882a593Smuzhiyun };
72*4882a593Smuzhiyun+#else
73*4882a593Smuzhiyun+static const struct proc_ops rtw_adapter_proc_fops = {
74*4882a593Smuzhiyun+	.proc_open = rtw_adapter_proc_open,
75*4882a593Smuzhiyun+	.proc_read = seq_read,
76*4882a593Smuzhiyun+	.proc_lseek = seq_lseek,
77*4882a593Smuzhiyun+	.proc_release = single_release,
78*4882a593Smuzhiyun+	.proc_write = rtw_adapter_proc_write,
79*4882a593Smuzhiyun+};
80*4882a593Smuzhiyun+#endif
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun int proc_get_odm_dbg_comp(struct seq_file *m, void *v)
83*4882a593Smuzhiyun {
84*4882a593Smuzhiyun@@ -1030,6 +1056,7 @@ static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer,
85*4882a593Smuzhiyun 	return -EROFS;
86*4882a593Smuzhiyun }
87*4882a593Smuzhiyun
88*4882a593Smuzhiyun+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 6, 0))
89*4882a593Smuzhiyun static const struct file_operations rtw_odm_proc_fops = {
90*4882a593Smuzhiyun 	.owner = THIS_MODULE,
91*4882a593Smuzhiyun 	.open = rtw_odm_proc_open,
92*4882a593Smuzhiyun@@ -1038,6 +1065,15 @@ static const struct file_operations rtw_odm_proc_fops = {
93*4882a593Smuzhiyun 	.release = single_release,
94*4882a593Smuzhiyun 	.write = rtw_odm_proc_write,
95*4882a593Smuzhiyun };
96*4882a593Smuzhiyun+#else
97*4882a593Smuzhiyun+static const struct proc_ops rtw_odm_proc_fops = {
98*4882a593Smuzhiyun+	.proc_open = rtw_odm_proc_open,
99*4882a593Smuzhiyun+	.proc_read = seq_read,
100*4882a593Smuzhiyun+	.proc_lseek = seq_lseek,
101*4882a593Smuzhiyun+	.proc_release = single_release,
102*4882a593Smuzhiyun+	.proc_write = rtw_odm_proc_write,
103*4882a593Smuzhiyun+};
104*4882a593Smuzhiyun+#endif
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun struct proc_dir_entry *rtw_odm_proc_init(struct net_device *dev)
107*4882a593Smuzhiyun {
108*4882a593Smuzhiyun--
109*4882a593Smuzhiyun2.29.0
110*4882a593Smuzhiyun
111