1
From: Alan Cox <alan@linux.intel.com>
2
Date: Thu, 16 Sep 2010 18:21:52 +0100
3
Subject: [PATCH 2/4] tty: icount changeover for other main devices
5
commit 0587102cf9f427c185bfdeb2cef41e13ee0264b1 upstream.
7
Again basically cut and paste
9
Convert the main driver set to use the hooks for GICOUNT
11
Signed-off-by: Alan Cox <alan@linux.intel.com>
12
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
14
arch/ia64/hp/sim/simserial.c | 12 +------
15
drivers/char/amiserial.c | 56 ++++++++++++++++-------------
16
drivers/char/cyclades.c | 49 +++++++++++++------------
17
drivers/char/ip2/ip2main.c | 72 ++++++++++++++++++++++---------------
18
drivers/char/mxser.c | 62 ++++++++++++++++++--------------
19
drivers/char/nozomi.c | 37 +++++++++----------
20
drivers/char/pcmcia/synclink_cs.c | 60 ++++++++++++++-----------------
21
drivers/char/synclink.c | 73 +++++++++++++++++--------------------
22
drivers/char/synclink_gt.c | 56 +++++++++++++++--------------
23
drivers/char/synclinkmp.c | 61 ++++++++++++++-----------------
24
drivers/serial/68360serial.c | 51 +++++++++++++-------------
25
net/bluetooth/rfcomm/tty.c | 4 --
26
12 files changed, 297 insertions(+), 296 deletions(-)
28
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
29
index 2bef526..204f650 100644
30
--- a/arch/ia64/hp/sim/simserial.c
31
+++ b/arch/ia64/hp/sim/simserial.c
32
@@ -395,7 +395,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
34
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
35
(cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT) &&
36
- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
37
+ (cmd != TIOCMIWAIT)) {
38
if (tty->flags & (1 << TTY_IO_ERROR))
41
@@ -433,16 +433,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
43
printk(KERN_INFO "rs_ioctl: TIOCMIWAIT: called\n");
46
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
47
- * Return: write counters to the user passed counter struct
48
- * NB: both 1->0 and 0->1 transitions are counted except for
49
- * RI where only 0->1 is counted.
52
- printk(KERN_INFO "rs_ioctl: TIOCGICOUNT called\n");
57
/* "setserial -W" is called in Debian boot */
58
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c
59
index 6c32fbf..579d479 100644
60
--- a/drivers/char/amiserial.c
61
+++ b/drivers/char/amiserial.c
62
@@ -1262,6 +1262,36 @@ static int rs_break(struct tty_struct *tty, int break_state)
67
+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
68
+ * Return: write counters to the user passed counter struct
69
+ * NB: both 1->0 and 0->1 transitions are counted except for
70
+ * RI where only 0->1 is counted.
72
+static int rs_get_icount(struct tty_struct *tty,
73
+ struct serial_icounter_struct *icount)
75
+ struct async_struct *info = tty->driver_data;
76
+ struct async_icount cnow;
77
+ unsigned long flags;
79
+ local_irq_save(flags);
80
+ cnow = info->state->icount;
81
+ local_irq_restore(flags);
82
+ icount->cts = cnow.cts;
83
+ icount->dsr = cnow.dsr;
84
+ icount->rng = cnow.rng;
85
+ icount->dcd = cnow.dcd;
86
+ icount->rx = cnow.rx;
87
+ icount->tx = cnow.tx;
88
+ icount->frame = cnow.frame;
89
+ icount->overrun = cnow.overrun;
90
+ icount->parity = cnow.parity;
91
+ icount->brk = cnow.brk;
92
+ icount->buf_overrun = cnow.buf_overrun;
97
static int rs_ioctl(struct tty_struct *tty, struct file * file,
98
unsigned int cmd, unsigned long arg)
99
@@ -1331,31 +1361,6 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
104
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
105
- * Return: write counters to the user passed counter struct
106
- * NB: both 1->0 and 0->1 transitions are counted except for
107
- * RI where only 0->1 is counted.
110
- local_irq_save(flags);
111
- cnow = info->state->icount;
112
- local_irq_restore(flags);
113
- icount.cts = cnow.cts;
114
- icount.dsr = cnow.dsr;
115
- icount.rng = cnow.rng;
116
- icount.dcd = cnow.dcd;
117
- icount.rx = cnow.rx;
118
- icount.tx = cnow.tx;
119
- icount.frame = cnow.frame;
120
- icount.overrun = cnow.overrun;
121
- icount.parity = cnow.parity;
122
- icount.brk = cnow.brk;
123
- icount.buf_overrun = cnow.buf_overrun;
125
- if (copy_to_user(argp, &icount, sizeof(icount)))
130
/* "setserial -W" is called in Debian boot */
131
@@ -1948,6 +1953,7 @@ static const struct tty_operations serial_ops = {
132
.wait_until_sent = rs_wait_until_sent,
133
.tiocmget = rs_tiocmget,
134
.tiocmset = rs_tiocmset,
135
+ .get_icount = rs_get_icount,
136
.proc_fops = &rs_proc_fops,
139
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
140
index 0113574..eb863de 100644
141
--- a/drivers/char/cyclades.c
142
+++ b/drivers/char/cyclades.c
143
@@ -2798,29 +2798,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
144
* NB: both 1->0 and 0->1 transitions are counted except for
145
* RI where only 0->1 is counted.
147
- case TIOCGICOUNT: {
148
- struct serial_icounter_struct sic = { };
150
- spin_lock_irqsave(&info->card->card_lock, flags);
151
- cnow = info->icount;
152
- spin_unlock_irqrestore(&info->card->card_lock, flags);
154
- sic.cts = cnow.cts;
155
- sic.dsr = cnow.dsr;
156
- sic.rng = cnow.rng;
157
- sic.dcd = cnow.dcd;
160
- sic.frame = cnow.frame;
161
- sic.overrun = cnow.overrun;
162
- sic.parity = cnow.parity;
163
- sic.brk = cnow.brk;
164
- sic.buf_overrun = cnow.buf_overrun;
166
- if (copy_to_user(argp, &sic, sizeof(sic)))
171
ret_val = -ENOIOCTLCMD;
173
@@ -2832,6 +2809,31 @@ cy_ioctl(struct tty_struct *tty, struct file *file,
177
+static int cy_get_icount(struct tty_struct *tty,
178
+ struct serial_icounter_struct *sic)
180
+ struct cyclades_port *info = tty->driver_data;
181
+ struct cyclades_icount cnow; /* Used to snapshot */
182
+ unsigned long flags;
184
+ spin_lock_irqsave(&info->card->card_lock, flags);
185
+ cnow = info->icount;
186
+ spin_unlock_irqrestore(&info->card->card_lock, flags);
188
+ sic->cts = cnow.cts;
189
+ sic->dsr = cnow.dsr;
190
+ sic->rng = cnow.rng;
191
+ sic->dcd = cnow.dcd;
194
+ sic->frame = cnow.frame;
195
+ sic->overrun = cnow.overrun;
196
+ sic->parity = cnow.parity;
197
+ sic->brk = cnow.brk;
198
+ sic->buf_overrun = cnow.buf_overrun;
203
* This routine allows the tty driver to be notified when
204
* device's termios settings have changed. Note that a
205
@@ -4098,6 +4100,7 @@ static const struct tty_operations cy_ops = {
206
.wait_until_sent = cy_wait_until_sent,
207
.tiocmget = cy_tiocmget,
208
.tiocmset = cy_tiocmset,
209
+ .get_icount = cy_get_icount,
210
.proc_fops = &cyclades_proc_fops,
213
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c
214
index 791e589..e04c1d3 100644
215
--- a/drivers/char/ip2/ip2main.c
216
+++ b/drivers/char/ip2/ip2main.c
217
@@ -183,6 +183,8 @@ static void ip2_hangup(PTTY);
218
static int ip2_tiocmget(struct tty_struct *tty, struct file *file);
219
static int ip2_tiocmset(struct tty_struct *tty, struct file *file,
220
unsigned int set, unsigned int clear);
221
+static int ip2_get_icount(struct tty_struct *tty,
222
+ struct serial_icounter_struct *icount);
224
static void set_irq(int, int);
225
static void ip2_interrupt_bh(struct work_struct *work);
226
@@ -448,6 +450,7 @@ static const struct tty_operations ip2_ops = {
227
.hangup = ip2_hangup,
228
.tiocmget = ip2_tiocmget,
229
.tiocmset = ip2_tiocmset,
230
+ .get_icount = ip2_get_icount,
231
.proc_fops = &ip2_proc_fops,
234
@@ -2112,7 +2115,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
235
i2ChanStrPtr pCh = DevTable[tty->index];
237
struct async_icount cprev, cnow; /* kernel counter temps */
238
- struct serial_icounter_struct __user *p_cuser;
241
void __user *argp = (void __user *)arg;
242
@@ -2281,34 +2283,6 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
246
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
247
- * Return: write counters to the user passed counter struct
248
- * NB: both 1->0 and 0->1 transitions are counted except for RI where
249
- * only 0->1 is counted. The controller is quite capable of counting
250
- * both, but this done to preserve compatibility with the standard
254
- ip2trace (CHANN, ITRC_IOCTL, 11, 1, rc );
256
- write_lock_irqsave(&pB->read_fifo_spinlock, flags);
257
- cnow = pCh->icount;
258
- write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
260
- rc = put_user(cnow.cts, &p_cuser->cts);
261
- rc = put_user(cnow.dsr, &p_cuser->dsr);
262
- rc = put_user(cnow.rng, &p_cuser->rng);
263
- rc = put_user(cnow.dcd, &p_cuser->dcd);
264
- rc = put_user(cnow.rx, &p_cuser->rx);
265
- rc = put_user(cnow.tx, &p_cuser->tx);
266
- rc = put_user(cnow.frame, &p_cuser->frame);
267
- rc = put_user(cnow.overrun, &p_cuser->overrun);
268
- rc = put_user(cnow.parity, &p_cuser->parity);
269
- rc = put_user(cnow.brk, &p_cuser->brk);
270
- rc = put_user(cnow.buf_overrun, &p_cuser->buf_overrun);
274
* The rest are not supported by this driver. By returning -ENOIOCTLCMD they
275
* will be passed to the line discipline for it to handle.
277
@@ -2332,6 +2306,46 @@ ip2_ioctl ( PTTY tty, struct file *pFile, UINT cmd, ULONG arg )
281
+static int ip2_get_icount(struct tty_struct *tty,
282
+ struct serial_icounter_struct *icount)
284
+ i2ChanStrPtr pCh = DevTable[tty->index];
286
+ struct async_icount cnow; /* kernel counter temp */
287
+ unsigned long flags;
295
+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
296
+ * Return: write counters to the user passed counter struct
297
+ * NB: both 1->0 and 0->1 transitions are counted except for RI where
298
+ * only 0->1 is counted. The controller is quite capable of counting
299
+ * both, but this done to preserve compatibility with the standard
303
+ write_lock_irqsave(&pB->read_fifo_spinlock, flags);
304
+ cnow = pCh->icount;
305
+ write_unlock_irqrestore(&pB->read_fifo_spinlock, flags);
307
+ icount->cts = cnow.cts;
308
+ icount->dsr = cnow.dsr;
309
+ icount->rng = cnow.rng;
310
+ icount->dcd = cnow.dcd;
311
+ icount->rx = cnow.rx;
312
+ icount->tx = cnow.tx;
313
+ icount->frame = cnow.frame;
314
+ icount->overrun = cnow.overrun;
315
+ icount->parity = cnow.parity;
316
+ icount->brk = cnow.brk;
317
+ icount->buf_overrun = cnow.buf_overrun;
321
/******************************************************************************/
322
/* Function: GetSerialInfo() */
323
/* Parameters: Pointer to channel structure */
324
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
325
index 5e28d39..4b97406 100644
326
--- a/drivers/char/mxser.c
327
+++ b/drivers/char/mxser.c
328
@@ -1736,7 +1736,7 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
332
- if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT && cmd != TIOCGICOUNT &&
333
+ if (cmd != TIOCGSERIAL && cmd != TIOCMIWAIT &&
334
test_bit(TTY_IO_ERROR, &tty->flags))
337
@@ -1766,32 +1766,6 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
339
return wait_event_interruptible(info->port.delta_msr_wait,
340
mxser_cflags_changed(info, arg, &cnow));
342
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
343
- * Return: write counters to the user passed counter struct
344
- * NB: both 1->0 and 0->1 transitions are counted except for
345
- * RI where only 0->1 is counted.
347
- case TIOCGICOUNT: {
348
- struct serial_icounter_struct icnt = { 0 };
349
- spin_lock_irqsave(&info->slock, flags);
350
- cnow = info->icount;
351
- spin_unlock_irqrestore(&info->slock, flags);
353
- icnt.frame = cnow.frame;
354
- icnt.brk = cnow.brk;
355
- icnt.overrun = cnow.overrun;
356
- icnt.buf_overrun = cnow.buf_overrun;
357
- icnt.parity = cnow.parity;
360
- icnt.cts = cnow.cts;
361
- icnt.dsr = cnow.dsr;
362
- icnt.rng = cnow.rng;
363
- icnt.dcd = cnow.dcd;
365
- return copy_to_user(argp, &icnt, sizeof(icnt)) ? -EFAULT : 0;
367
case MOXA_HighSpeedOn:
368
return put_user(info->baud_base != 115200 ? 1 : 0, (int __user *)argp);
369
case MOXA_SDS_RSTICOUNTER:
370
@@ -1862,6 +1836,39 @@ static int mxser_ioctl(struct tty_struct *tty, struct file *file,
375
+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
376
+ * Return: write counters to the user passed counter struct
377
+ * NB: both 1->0 and 0->1 transitions are counted except for
378
+ * RI where only 0->1 is counted.
381
+static int mxser_get_icount(struct tty_struct *tty,
382
+ struct serial_icounter_struct *icount)
385
+ struct mxser_port *info = tty->driver_data;
386
+ struct async_icount cnow;
387
+ unsigned long flags;
389
+ spin_lock_irqsave(&info->slock, flags);
390
+ cnow = info->icount;
391
+ spin_unlock_irqrestore(&info->slock, flags);
393
+ icount->frame = cnow.frame;
394
+ icount->brk = cnow.brk;
395
+ icount->overrun = cnow.overrun;
396
+ icount->buf_overrun = cnow.buf_overrun;
397
+ icount->parity = cnow.parity;
398
+ icount->rx = cnow.rx;
399
+ icount->tx = cnow.tx;
400
+ icount->cts = cnow.cts;
401
+ icount->dsr = cnow.dsr;
402
+ icount->rng = cnow.rng;
403
+ icount->dcd = cnow.dcd;
407
static void mxser_stoprx(struct tty_struct *tty)
409
struct mxser_port *info = tty->driver_data;
410
@@ -2358,6 +2365,7 @@ static const struct tty_operations mxser_ops = {
411
.wait_until_sent = mxser_wait_until_sent,
412
.tiocmget = mxser_tiocmget,
413
.tiocmset = mxser_tiocmset,
414
+ .get_icount = mxser_get_icount,
417
struct tty_port_operations mxser_port_ops = {
418
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
419
index dc52f75..19b3e1d 100644
420
--- a/drivers/char/nozomi.c
421
+++ b/drivers/char/nozomi.c
422
@@ -1783,24 +1783,24 @@ static int ntty_cflags_changed(struct port *port, unsigned long flags,
426
-static int ntty_ioctl_tiocgicount(struct port *port, void __user *argp)
427
+static int ntty_tiocgicount(struct tty_struct *tty,
428
+ struct serial_icounter_struct *icount)
430
+ struct port *port = tty->driver_data;
431
const struct async_icount cnow = port->tty_icount;
432
- struct serial_icounter_struct icount;
434
- icount.cts = cnow.cts;
435
- icount.dsr = cnow.dsr;
436
- icount.rng = cnow.rng;
437
- icount.dcd = cnow.dcd;
438
- icount.rx = cnow.rx;
439
- icount.tx = cnow.tx;
440
- icount.frame = cnow.frame;
441
- icount.overrun = cnow.overrun;
442
- icount.parity = cnow.parity;
443
- icount.brk = cnow.brk;
444
- icount.buf_overrun = cnow.buf_overrun;
446
- return copy_to_user(argp, &icount, sizeof(icount)) ? -EFAULT : 0;
448
+ icount->cts = cnow.cts;
449
+ icount->dsr = cnow.dsr;
450
+ icount->rng = cnow.rng;
451
+ icount->dcd = cnow.dcd;
452
+ icount->rx = cnow.rx;
453
+ icount->tx = cnow.tx;
454
+ icount->frame = cnow.frame;
455
+ icount->overrun = cnow.overrun;
456
+ icount->parity = cnow.parity;
457
+ icount->brk = cnow.brk;
458
+ icount->buf_overrun = cnow.buf_overrun;
462
static int ntty_ioctl(struct tty_struct *tty, struct file *file,
463
@@ -1819,9 +1819,7 @@ static int ntty_ioctl(struct tty_struct *tty, struct file *file,
464
rval = wait_event_interruptible(port->tty_wait,
465
ntty_cflags_changed(port, arg, &cprev));
467
- } case TIOCGICOUNT:
468
- rval = ntty_ioctl_tiocgicount(port, argp);
472
DBG1("ERR: 0x%08X, %d", cmd, cmd);
474
@@ -1895,6 +1893,7 @@ static const struct tty_operations tty_ops = {
475
.chars_in_buffer = ntty_chars_in_buffer,
476
.tiocmget = ntty_tiocmget,
477
.tiocmset = ntty_tiocmset,
478
+ .get_icount = ntty_tiocgicount,
481
/* Module initialization */
482
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c
483
index a08c899..74d124b 100644
484
--- a/drivers/char/pcmcia/synclink_cs.c
485
+++ b/drivers/char/pcmcia/synclink_cs.c
486
@@ -2252,6 +2252,32 @@ static int mgslpc_break(struct tty_struct *tty, int break_state)
490
+static int mgslpc_get_icount(struct tty_struct *tty,
491
+ struct serial_icounter_struct *icount)
493
+ MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
494
+ struct mgsl_icount cnow; /* kernel counter temps */
495
+ unsigned long flags;
497
+ spin_lock_irqsave(&info->lock,flags);
498
+ cnow = info->icount;
499
+ spin_unlock_irqrestore(&info->lock,flags);
501
+ icount->cts = cnow.cts;
502
+ icount->dsr = cnow.dsr;
503
+ icount->rng = cnow.rng;
504
+ icount->dcd = cnow.dcd;
505
+ icount->rx = cnow.rx;
506
+ icount->tx = cnow.tx;
507
+ icount->frame = cnow.frame;
508
+ icount->overrun = cnow.overrun;
509
+ icount->parity = cnow.parity;
510
+ icount->brk = cnow.brk;
511
+ icount->buf_overrun = cnow.buf_overrun;
516
/* Service an IOCTL request
519
@@ -2267,11 +2293,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
520
unsigned int cmd, unsigned long arg)
522
MGSLPC_INFO * info = (MGSLPC_INFO *)tty->driver_data;
524
- struct mgsl_icount cnow; /* kernel counter temps */
525
- struct serial_icounter_struct __user *p_cuser; /* user space */
526
void __user *argp = (void __user *)arg;
527
- unsigned long flags;
529
if (debug_level >= DEBUG_LEVEL_INFO)
530
printk("%s(%d):mgslpc_ioctl %s cmd=%08X\n", __FILE__,__LINE__,
531
@@ -2281,7 +2303,7 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
534
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
535
- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
536
+ (cmd != TIOCMIWAIT)) {
537
if (tty->flags & (1 << TTY_IO_ERROR))
540
@@ -2311,34 +2333,6 @@ static int mgslpc_ioctl(struct tty_struct *tty, struct file * file,
541
return wait_events(info, argp);
543
return modem_input_wait(info,(int)arg);
545
- spin_lock_irqsave(&info->lock,flags);
546
- cnow = info->icount;
547
- spin_unlock_irqrestore(&info->lock,flags);
549
- PUT_USER(error,cnow.cts, &p_cuser->cts);
550
- if (error) return error;
551
- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
552
- if (error) return error;
553
- PUT_USER(error,cnow.rng, &p_cuser->rng);
554
- if (error) return error;
555
- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
556
- if (error) return error;
557
- PUT_USER(error,cnow.rx, &p_cuser->rx);
558
- if (error) return error;
559
- PUT_USER(error,cnow.tx, &p_cuser->tx);
560
- if (error) return error;
561
- PUT_USER(error,cnow.frame, &p_cuser->frame);
562
- if (error) return error;
563
- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
564
- if (error) return error;
565
- PUT_USER(error,cnow.parity, &p_cuser->parity);
566
- if (error) return error;
567
- PUT_USER(error,cnow.brk, &p_cuser->brk);
568
- if (error) return error;
569
- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
570
- if (error) return error;
575
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
576
index 4846b73..b118959 100644
577
--- a/drivers/char/synclink.c
578
+++ b/drivers/char/synclink.c
579
@@ -2920,6 +2920,38 @@ static int mgsl_break(struct tty_struct *tty, int break_state)
581
} /* end of mgsl_break() */
584
+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
585
+ * Return: write counters to the user passed counter struct
586
+ * NB: both 1->0 and 0->1 transitions are counted except for
587
+ * RI where only 0->1 is counted.
589
+static int msgl_get_icount(struct tty_struct *tty,
590
+ struct serial_icounter_struct *icount)
593
+ struct mgsl_struct * info = tty->driver_data;
594
+ struct mgsl_icount cnow; /* kernel counter temps */
595
+ unsigned long flags;
597
+ spin_lock_irqsave(&info->irq_spinlock,flags);
598
+ cnow = info->icount;
599
+ spin_unlock_irqrestore(&info->irq_spinlock,flags);
601
+ icount->cts = cnow.cts;
602
+ icount->dsr = cnow.dsr;
603
+ icount->rng = cnow.rng;
604
+ icount->dcd = cnow.dcd;
605
+ icount->rx = cnow.rx;
606
+ icount->tx = cnow.tx;
607
+ icount->frame = cnow.frame;
608
+ icount->overrun = cnow.overrun;
609
+ icount->parity = cnow.parity;
610
+ icount->brk = cnow.brk;
611
+ icount->buf_overrun = cnow.buf_overrun;
615
/* mgsl_ioctl() Service an IOCTL request
618
@@ -2945,7 +2977,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file,
621
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
622
- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
623
+ (cmd != TIOCMIWAIT)) {
624
if (tty->flags & (1 << TTY_IO_ERROR))
627
@@ -2958,11 +2990,7 @@ static int mgsl_ioctl(struct tty_struct *tty, struct file * file,
629
static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long arg)
632
- struct mgsl_icount cnow; /* kernel counter temps */
633
void __user *argp = (void __user *)arg;
634
- struct serial_icounter_struct __user *p_cuser; /* user space */
635
- unsigned long flags;
638
case MGSL_IOCGPARAMS:
639
@@ -2991,40 +3019,6 @@ static int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigne
641
return modem_input_wait(info,(int)arg);
644
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
645
- * Return: write counters to the user passed counter struct
646
- * NB: both 1->0 and 0->1 transitions are counted except for
647
- * RI where only 0->1 is counted.
650
- spin_lock_irqsave(&info->irq_spinlock,flags);
651
- cnow = info->icount;
652
- spin_unlock_irqrestore(&info->irq_spinlock,flags);
654
- PUT_USER(error,cnow.cts, &p_cuser->cts);
655
- if (error) return error;
656
- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
657
- if (error) return error;
658
- PUT_USER(error,cnow.rng, &p_cuser->rng);
659
- if (error) return error;
660
- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
661
- if (error) return error;
662
- PUT_USER(error,cnow.rx, &p_cuser->rx);
663
- if (error) return error;
664
- PUT_USER(error,cnow.tx, &p_cuser->tx);
665
- if (error) return error;
666
- PUT_USER(error,cnow.frame, &p_cuser->frame);
667
- if (error) return error;
668
- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
669
- if (error) return error;
670
- PUT_USER(error,cnow.parity, &p_cuser->parity);
671
- if (error) return error;
672
- PUT_USER(error,cnow.brk, &p_cuser->brk);
673
- if (error) return error;
674
- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
675
- if (error) return error;
680
@@ -4325,6 +4319,7 @@ static const struct tty_operations mgsl_ops = {
681
.hangup = mgsl_hangup,
682
.tiocmget = tiocmget,
683
.tiocmset = tiocmset,
684
+ .get_icount = msgl_get_icount,
685
.proc_fops = &mgsl_proc_fops,
688
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c
689
index 8678f0c..c300ff6 100644
690
--- a/drivers/char/synclink_gt.c
691
+++ b/drivers/char/synclink_gt.c
692
@@ -1057,9 +1057,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
693
unsigned int cmd, unsigned long arg)
695
struct slgt_info *info = tty->driver_data;
696
- struct mgsl_icount cnow; /* kernel counter temps */
697
- struct serial_icounter_struct __user *p_cuser; /* user space */
698
- unsigned long flags;
699
void __user *argp = (void __user *)arg;
702
@@ -1068,7 +1065,7 @@ static int ioctl(struct tty_struct *tty, struct file *file,
703
DBGINFO(("%s ioctl() cmd=%08X\n", info->device_name, cmd));
705
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
706
- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
707
+ (cmd != TIOCMIWAIT)) {
708
if (tty->flags & (1 << TTY_IO_ERROR))
711
@@ -1121,25 +1118,6 @@ static int ioctl(struct tty_struct *tty, struct file *file,
712
case MGSL_IOCWAITGPIO:
713
ret = wait_gpio(info, argp);
716
- spin_lock_irqsave(&info->lock,flags);
717
- cnow = info->icount;
718
- spin_unlock_irqrestore(&info->lock,flags);
720
- if (put_user(cnow.cts, &p_cuser->cts) ||
721
- put_user(cnow.dsr, &p_cuser->dsr) ||
722
- put_user(cnow.rng, &p_cuser->rng) ||
723
- put_user(cnow.dcd, &p_cuser->dcd) ||
724
- put_user(cnow.rx, &p_cuser->rx) ||
725
- put_user(cnow.tx, &p_cuser->tx) ||
726
- put_user(cnow.frame, &p_cuser->frame) ||
727
- put_user(cnow.overrun, &p_cuser->overrun) ||
728
- put_user(cnow.parity, &p_cuser->parity) ||
729
- put_user(cnow.brk, &p_cuser->brk) ||
730
- put_user(cnow.buf_overrun, &p_cuser->buf_overrun))
737
@@ -1147,6 +1125,33 @@ static int ioctl(struct tty_struct *tty, struct file *file,
741
+static int get_icount(struct tty_struct *tty,
742
+ struct serial_icounter_struct *icount)
745
+ struct slgt_info *info = tty->driver_data;
746
+ struct mgsl_icount cnow; /* kernel counter temps */
747
+ unsigned long flags;
749
+ spin_lock_irqsave(&info->lock,flags);
750
+ cnow = info->icount;
751
+ spin_unlock_irqrestore(&info->lock,flags);
753
+ icount->cts = cnow.cts;
754
+ icount->dsr = cnow.dsr;
755
+ icount->rng = cnow.rng;
756
+ icount->dcd = cnow.dcd;
757
+ icount->rx = cnow.rx;
758
+ icount->tx = cnow.tx;
759
+ icount->frame = cnow.frame;
760
+ icount->overrun = cnow.overrun;
761
+ icount->parity = cnow.parity;
762
+ icount->brk = cnow.brk;
763
+ icount->buf_overrun = cnow.buf_overrun;
769
* support for 32 bit ioctl calls on 64 bit systems
771
@@ -1236,10 +1241,6 @@ static long slgt_compat_ioctl(struct tty_struct *tty, struct file *file,
774
case MGSL_IOCWAITGPIO:
776
- rc = ioctl(tty, file, cmd, (unsigned long)(compat_ptr(arg)));
779
case MGSL_IOCSTXIDLE:
780
case MGSL_IOCTXENABLE:
781
case MGSL_IOCRXENABLE:
782
@@ -3639,6 +3640,7 @@ static const struct tty_operations ops = {
784
.tiocmget = tiocmget,
785
.tiocmset = tiocmset,
786
+ .get_icount = get_icount,
787
.proc_fops = &synclink_gt_proc_fops,
790
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c
791
index 2b18adc..951b65f 100644
792
--- a/drivers/char/synclinkmp.c
793
+++ b/drivers/char/synclinkmp.c
794
@@ -1255,10 +1255,6 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
795
unsigned int cmd, unsigned long arg)
797
SLMP_INFO *info = tty->driver_data;
799
- struct mgsl_icount cnow; /* kernel counter temps */
800
- struct serial_icounter_struct __user *p_cuser; /* user space */
801
- unsigned long flags;
802
void __user *argp = (void __user *)arg;
804
if (debug_level >= DEBUG_LEVEL_INFO)
805
@@ -1269,7 +1265,7 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
808
if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) &&
809
- (cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
810
+ (cmd != TIOCMIWAIT)) {
811
if (tty->flags & (1 << TTY_IO_ERROR))
814
@@ -1307,40 +1303,38 @@ static int do_ioctl(struct tty_struct *tty, struct file *file,
815
* NB: both 1->0 and 0->1 transitions are counted except for
816
* RI where only 0->1 is counted.
819
- spin_lock_irqsave(&info->lock,flags);
820
- cnow = info->icount;
821
- spin_unlock_irqrestore(&info->lock,flags);
823
- PUT_USER(error,cnow.cts, &p_cuser->cts);
824
- if (error) return error;
825
- PUT_USER(error,cnow.dsr, &p_cuser->dsr);
826
- if (error) return error;
827
- PUT_USER(error,cnow.rng, &p_cuser->rng);
828
- if (error) return error;
829
- PUT_USER(error,cnow.dcd, &p_cuser->dcd);
830
- if (error) return error;
831
- PUT_USER(error,cnow.rx, &p_cuser->rx);
832
- if (error) return error;
833
- PUT_USER(error,cnow.tx, &p_cuser->tx);
834
- if (error) return error;
835
- PUT_USER(error,cnow.frame, &p_cuser->frame);
836
- if (error) return error;
837
- PUT_USER(error,cnow.overrun, &p_cuser->overrun);
838
- if (error) return error;
839
- PUT_USER(error,cnow.parity, &p_cuser->parity);
840
- if (error) return error;
841
- PUT_USER(error,cnow.brk, &p_cuser->brk);
842
- if (error) return error;
843
- PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
844
- if (error) return error;
852
+static int get_icount(struct tty_struct *tty,
853
+ struct serial_icounter_struct *icount)
855
+ SLMP_INFO *info = tty->driver_data;
856
+ struct mgsl_icount cnow; /* kernel counter temps */
857
+ unsigned long flags;
859
+ spin_lock_irqsave(&info->lock,flags);
860
+ cnow = info->icount;
861
+ spin_unlock_irqrestore(&info->lock,flags);
863
+ icount->cts = cnow.cts;
864
+ icount->dsr = cnow.dsr;
865
+ icount->rng = cnow.rng;
866
+ icount->dcd = cnow.dcd;
867
+ icount->rx = cnow.rx;
868
+ icount->tx = cnow.tx;
869
+ icount->frame = cnow.frame;
870
+ icount->overrun = cnow.overrun;
871
+ icount->parity = cnow.parity;
872
+ icount->brk = cnow.brk;
873
+ icount->buf_overrun = cnow.buf_overrun;
878
static int ioctl(struct tty_struct *tty, struct file *file,
879
unsigned int cmd, unsigned long arg)
881
@@ -3908,6 +3902,7 @@ static const struct tty_operations ops = {
883
.tiocmget = tiocmget,
884
.tiocmset = tiocmset,
885
+ .get_icount = get_icount,
886
.proc_fops = &synclinkmp_proc_fops,
889
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
890
index 24661cd..1e4f831 100644
891
--- a/drivers/serial/68360serial.c
892
+++ b/drivers/serial/68360serial.c
893
@@ -1381,6 +1381,30 @@ static void send_break(ser_info_t *info, unsigned int duration)
898
+ * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
899
+ * Return: write counters to the user passed counter struct
900
+ * NB: both 1->0 and 0->1 transitions are counted except for
901
+ * RI where only 0->1 is counted.
903
+static int rs_360_get_icount(struct tty_struct *tty,
904
+ struct serial_icounter_struct *icount)
906
+ ser_info_t *info = (ser_info_t *)tty->driver_data;
907
+ struct async_icount cnow;
909
+ local_irq_disable();
910
+ cnow = info->state->icount;
911
+ local_irq_enable();
913
+ icount->cts = cnow.cts;
914
+ icount->dsr = cnow.dsr;
915
+ icount->rng = cnow.rng;
916
+ icount->dcd = cnow.dcd;
921
static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
922
unsigned int cmd, unsigned long arg)
924
@@ -1394,7 +1418,7 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
925
if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
928
- if ((cmd != TIOCMIWAIT) && (cmd != TIOCGICOUNT)) {
929
+ if (cmd != TIOCMIWAIT) {
930
if (tty->flags & (1 << TTY_IO_ERROR))
933
@@ -1477,31 +1501,6 @@ static int rs_360_ioctl(struct tty_struct *tty, struct file * file,
938
- * Get counter of input serial line interrupts (DCD,RI,DSR,CTS)
939
- * Return: write counters to the user passed counter struct
940
- * NB: both 1->0 and 0->1 transitions are counted except for
941
- * RI where only 0->1 is counted.
944
- local_irq_disable();
945
- cnow = info->state->icount;
946
- local_irq_enable();
947
- p_cuser = (struct serial_icounter_struct *) arg;
948
-/* error = put_user(cnow.cts, &p_cuser->cts); */
949
-/* if (error) return error; */
950
-/* error = put_user(cnow.dsr, &p_cuser->dsr); */
951
-/* if (error) return error; */
952
-/* error = put_user(cnow.rng, &p_cuser->rng); */
953
-/* if (error) return error; */
954
-/* error = put_user(cnow.dcd, &p_cuser->dcd); */
955
-/* if (error) return error; */
957
- put_user(cnow.cts, &p_cuser->cts);
958
- put_user(cnow.dsr, &p_cuser->dsr);
959
- put_user(cnow.rng, &p_cuser->rng);
960
- put_user(cnow.dcd, &p_cuser->dcd);
965
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
966
index cab71ea..5f6a305 100644
967
--- a/net/bluetooth/rfcomm/tty.c
968
+++ b/net/bluetooth/rfcomm/tty.c
969
@@ -844,10 +844,6 @@ static int rfcomm_tty_ioctl(struct tty_struct *tty, struct file *filp, unsigned
970
BT_DBG("TIOCMIWAIT");
974
- BT_DBG("TIOCGICOUNT");
978
BT_ERR("TIOCGSERIAL is not supported");