blob: bdc1e66ad5f4e8377522044507a048294efaf863 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
--- npreal2.c.orig 2020-05-21 00:42:40.690229660 -0400
+++ npreal2.c 2020-05-21 00:40:48.857014581 -0400
@@ -366,11 +366,15 @@ static struct proc_dir_entry * npvar_pr
* memory if large numbers of serial ports are open.
*/
static unsigned char * npvar_tmp_buf;
static struct semaphore npvar_tmp_buf_sem;
+#if LINUX_VERSION_CODE >= VERSION_CODE(5,6,0)
+static struct proc_ops npreal_net_fops;
+#else
static struct file_operations npreal_net_fops;
+#endif
#ifdef MODULE
int init_module(void);
void cleanup_module(void);
#endif
@@ -668,17 +672,26 @@ npreal_init(void)
put_tty_driver(DRV_VAR);
return -1;
}
/* Initialize the net node structure */
- memset(&npreal_net_fops,0,sizeof(struct file_operations));
+ memset(&npreal_net_fops,0,sizeof(npreal_net_fops));
+#if LINUX_VERSION_CODE >= VERSION_CODE(5,6,0)
+ npreal_net_fops.proc_read = npreal_net_read;
+ npreal_net_fops.proc_write = npreal_net_write;
+ npreal_net_fops.proc_ioctl = npreal_net_ioctl;
+ npreal_net_fops.proc_open = npreal_net_open;
+ npreal_net_fops.proc_release = npreal_net_close;
+ npreal_net_fops.proc_poll = npreal_net_select;
+#else
npreal_net_fops.read = npreal_net_read;
npreal_net_fops.write = npreal_net_write;
npreal_net_fops.unlocked_ioctl = npreal_net_ioctl;
npreal_net_fops.open = npreal_net_open;
npreal_net_fops.release = npreal_net_close;
npreal_net_fops.poll = npreal_net_select;
+#endif
if (npreal_init_tty() != 0)
{
tty_unregister_driver(DRV_VAR);
DBGPRINT(MX_DEBUG_ERROR, "Couldn't install MOXA Async/NPort server family Real TTY driver !\n");
}
|