summarylogtreecommitdiffstats
path: root/0004-kernel-5.15-alloc_tty_driver-put_tty_driver.patch
blob: 945d3d88c3e2db07f23681de6da411c99b75bb2c (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
47
48
49
diff -pNaru5 snx_V2.0.5.0.orig-0000/driver/snx_serial.c snx_V2.0.5.0/driver/snx_serial.c
--- snx_V2.0.5.0.orig-0000/driver/snx_serial.c	2021-11-21 02:14:11.988063777 -0500
+++ snx_V2.0.5.0/driver/snx_serial.c	2021-11-21 02:15:27.978342167 -0500
@@ -4344,17 +4344,17 @@ extern int sunix_ser_register_driver(str
 
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0))
 	normal = tty_alloc_driver(SNX_SER_TOTAL_MAX + 1, TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV);
 #elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
-	normal = alloc_tty_driver(drv->nr);
+	normal = tty_alloc_driver(drv->nr,0);
 #else
 	normal = &drv->tty_driver;
 #endif
 
 
-	if (!normal) {
+	if (IS_ERR(normal)) {
 		printk("SNX Error: Allocate tty driver fail !\n\n");
 		goto out;
 	}
 
 
@@ -4445,11 +4445,11 @@ extern int sunix_ser_register_driver(str
 #endif
 
 out:
 	if (ret < 0) {
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0))
-		put_tty_driver(normal);
+		tty_driver_kref_put(normal);
 #endif
 		kfree(drv->state);
 	}
 
 	return (ret);
@@ -4470,11 +4470,11 @@ extern void sunix_ser_unregister_driver(
 	if (!normal) {
 		return;
 	}
 
 	tty_unregister_driver(normal);
-	put_tty_driver(normal);
+	tty_driver_kref_put(normal);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
 
 	for (i = 0; i < drv->nr; i++) {
 		struct snx_ser_state *state = drv->state + i;