summarylogtreecommitdiffstats
path: root/0008-kernel-6.1-remove-TTY_MAGIC.patch
blob: 4d079b09d8205b33388797f660f1c9ef27e8433a (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
diff -pNaru5 a/driver/2.6.27/dgnc_cls.c b/driver/2.6.27/dgnc_cls.c
--- a/driver/2.6.27/dgnc_cls.c	2017-10-21 10:39:21.000000000 -0400
+++ b/driver/2.6.27/dgnc_cls.c	2023-01-28 14:36:56.298578571 -0500
@@ -482,11 +482,11 @@ static void cls_param(struct tty_struct
 	int quot = 0;
         struct board_t *bd;
 	struct channel_t *ch;
         struct un_t   *un;
 
-	if (!tty || tty->magic != TTY_MAGIC) {
+	if (!tty || !tty->ldisc) {
 		return;
 	}
 
 	un = (struct un_t *) tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
@@ -979,11 +979,11 @@ static int cls_drain(struct tty_struct *
 	ulong lock_flags;
 	struct channel_t *ch;
         struct un_t *un;
 	int rc = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC) {
+	if (!tty || !tty->ldisc) {
 		return (-ENXIO);
 	}
 
 	un = (struct un_t *) tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
diff -pNaru5 a/driver/2.6.27/dgnc_neo.c b/driver/2.6.27/dgnc_neo.c
--- a/driver/2.6.27/dgnc_neo.c	2017-10-21 10:39:21.000000000 -0400
+++ b/driver/2.6.27/dgnc_neo.c	2023-01-28 14:36:49.068942864 -0500
@@ -656,11 +656,11 @@ static void neo_param(struct tty_struct
 	int quot = 0;
         struct board_t *bd;
 	struct channel_t *ch;
         struct un_t   *un;
 
-	if (!tty || tty->magic != TTY_MAGIC) {
+	if (!tty || !tty->ldisc) {
 		return;
 	}
 
 	un = (struct un_t *) tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
@@ -1432,11 +1432,11 @@ static int neo_drain(struct tty_struct *
 	ulong lock_flags;
 	struct channel_t *ch;
         struct un_t *un;
 	int rc = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC) {
+	if (!tty || !tty->ldisc) {
 		return (-ENXIO);
 	}
 
 	un = (struct un_t *) tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
diff -pNaru5 a/driver/2.6.27/dgnc_neo_II.c b/driver/2.6.27/dgnc_neo_II.c
--- a/driver/2.6.27/dgnc_neo_II.c	2017-10-21 10:39:21.000000000 -0400
+++ b/driver/2.6.27/dgnc_neo_II.c	2023-01-28 14:37:01.024996046 -0500
@@ -531,11 +531,11 @@ static void neo_II_param(struct tty_stru
 	int quot = 0;
         struct board_t *bd;
 	struct channel_t *ch;
         struct un_t   *un;
 
-	if (!tty || tty->magic != TTY_MAGIC) {
+	if (!tty || !tty->ldisc) {
 		return;
 	}
 
 	un = (struct un_t *) tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
@@ -1166,11 +1166,11 @@ static int neo_II_drain(struct tty_struc
 	ulong lock_flags;
 	struct channel_t *ch;
         struct un_t *un;
 	int rc = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC) {
+	if (!tty || !tty->ldisc) {
 		return (-ENXIO);
 	}
 
 	un = (struct un_t *) tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
diff -pNaru5 a/driver/2.6.27/dgnc_tty.c b/driver/2.6.27/dgnc_tty.c
--- a/driver/2.6.27/dgnc_tty.c	2023-01-28 14:28:53.575256967 -0500
+++ b/driver/2.6.27/dgnc_tty.c	2023-01-28 14:36:29.533153640 -0500
@@ -783,18 +783,18 @@ void dgnc_input(struct channel_t *ch)
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0)
 	if (!tp || (tp->magic != TTY_MAGIC) || !(ch->ch_tun.un_flags & UN_ISOPEN) || 
 	    !(tp->termios->c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING))
 #else
-        if (!tp  || (tp->magic != TTY_MAGIC) || !(ch->ch_tun.un_flags & UN_ISOPEN) ||
+        if (!tp  || !tp->ldisc || !(ch->ch_tun.un_flags & UN_ISOPEN) ||
 	    !(tp->termios.c_cflag & CREAD) || (ch->ch_tun.un_flags & UN_CLOSING))
 #endif
 	{
 
 		DPR_READ(("input. dropping %d bytes on port %d...\n", data_len, ch->ch_portnum));
-		DPR_READ(("input. tp: %p tp->magic: %x MAGIC:%x ch flags: %x\n",
-			tp, tp ? tp->magic : 0, TTY_MAGIC, ch->ch_tun.un_flags));
+		DPR_READ(("input. tp: %p ch flags: %x\n",
+			tp, ch->ch_tun.un_flags));
 
 		ch->ch_r_head = tail;
 
 		/* Force queue flow control to be released, if needed */
 		dgnc_check_queue_flow_control(ch);
@@ -1686,11 +1686,11 @@ static int dgnc_block_til_ready(struct t
 	struct un_t *un = NULL;
 	ulong   lock_flags;
 	uint	old_flags = 0;
 	int	sleep_on_un_flags = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC) {
+	if (!tty || !tty->ldisc || !file || !ch || ch->magic != DGNC_CHANNEL_MAGIC) {
 		return (-ENXIO);
 	}
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC) {
@@ -1848,11 +1848,11 @@ static int dgnc_block_til_ready(struct t
  */     
 static void dgnc_tty_hangup(struct tty_struct *tty)
 {
 	struct un_t	*un;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -1879,11 +1879,11 @@ static void dgnc_tty_close(struct tty_st
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong lock_flags;
 	int rc = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -2466,11 +2466,11 @@ static int dgnc_tty_tiocmget(struct tty_
 	struct un_t *un;
 	int result = -EIO;
 	uchar mstat = 0;
 	ulong   lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return result;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return result;
@@ -2525,11 +2525,11 @@ static int dgnc_tty_tiocmset(struct tty_
 	struct channel_t *ch;
 	struct un_t *un;
 	int ret = -EIO;
 	ulong   lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return ret;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return ret;
@@ -2584,11 +2584,11 @@ static int dgnc_tty_send_break(struct tt
 	struct channel_t *ch;
 	struct un_t *un;
 	int ret = -EIO;
 	ulong   lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return ret;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return ret;
@@ -2637,11 +2637,11 @@ static void dgnc_tty_wait_until_sent(str
 	struct board_t *bd;
 	struct channel_t *ch;
 	struct un_t *un;
 	int rc;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -2673,11 +2673,11 @@ static void dgnc_tty_send_xchar(struct t
 	struct board_t *bd;
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong   lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -2782,11 +2782,11 @@ static int dgnc_set_modem_info(struct tt
 	struct un_t *un;
 	int ret = -ENXIO;
 	unsigned int arg = 0;
 	ulong   lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return ret;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return ret;
@@ -2880,11 +2880,11 @@ static int dgnc_tty_digigeta(struct tty_
 	ulong   lock_flags;
 
 	if (!retinfo)
 		return (-EFAULT);
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return (-EFAULT);
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return (-EFAULT);
@@ -2922,11 +2922,11 @@ static int dgnc_tty_digiseta(struct tty_
 	struct digi_t new_digi;
 	ulong lock_flags;
 
 	DPR_IOCTL(("DIGI_SETA start\n"));
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return (-EFAULT);
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return (-EFAULT);
@@ -3003,11 +3003,11 @@ static void dgnc_tty_set_termios(struct
 	struct board_t *bd;
 	struct channel_t *ch;
 	struct un_t *un;
 	unsigned long lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3049,11 +3049,11 @@ static void dgnc_tty_throttle(struct tty
 {
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong   lock_flags = 0;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3078,11 +3078,11 @@ static void dgnc_tty_unthrottle(struct t
 {
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong   lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3108,11 +3108,11 @@ static void dgnc_tty_start(struct tty_st
 	struct board_t *bd;
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3142,11 +3142,11 @@ static void dgnc_tty_stop(struct tty_str
 	struct board_t *bd;
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3189,11 +3189,11 @@ static void dgnc_tty_flush_chars(struct
 	struct board_t *bd;
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3228,11 +3228,11 @@ static void dgnc_tty_flush_buffer(struct
 {
 	struct channel_t *ch;
 	struct un_t *un;
 	ulong lock_flags;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return;
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return;
@@ -3298,11 +3298,11 @@ dgnc_tty_ioctl(struct tty_struct *tty, u
 	struct un_t *un;
 	int rc;
 	ulong lock_flags;
 	void __user *uarg = (void __user *) arg;
 
-	if (!tty || tty->magic != TTY_MAGIC)
+	if (!tty || !tty->ldisc)
 		return (-ENODEV);
 
 	un = tty->driver_data;
 	if (!un || un->magic != DGNC_UNIT_MAGIC)
 		return (-ENODEV);