diff options
-rw-r--r-- | drivers/net/usb/hso.c | 35 | ||||
-rw-r--r-- | drivers/usb/serial/ark3116.c | 40 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 1 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 49 | ||||
-rw-r--r-- | drivers/usb/serial/io_tables.h | 4 | ||||
-rw-r--r-- | drivers/usb/serial/io_ti.c | 29 | ||||
-rw-r--r-- | drivers/usb/serial/mos7720.c | 54 | ||||
-rw-r--r-- | drivers/usb/serial/mos7840.c | 53 | ||||
-rw-r--r-- | drivers/usb/serial/ssu100.c | 46 | ||||
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 37 |
10 files changed, 203 insertions, 145 deletions
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 1cd752f9a6e1..b8e957249132 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1645,11 +1645,11 @@ hso_wait_modem_status(struct hso_serial *serial, unsigned long arg) | |||
1645 | * NB: both 1->0 and 0->1 transitions are counted except for | 1645 | * NB: both 1->0 and 0->1 transitions are counted except for |
1646 | * RI where only 0->1 is counted. | 1646 | * RI where only 0->1 is counted. |
1647 | */ | 1647 | */ |
1648 | static int hso_get_count(struct hso_serial *serial, | 1648 | static int hso_get_count(struct tty_struct *tty, |
1649 | struct serial_icounter_struct __user *icnt) | 1649 | struct serial_icounter_struct *icount) |
1650 | { | 1650 | { |
1651 | struct serial_icounter_struct icount; | ||
1652 | struct uart_icount cnow; | 1651 | struct uart_icount cnow; |
1652 | struct hso_serial *serial = get_serial_by_tty(tty); | ||
1653 | struct hso_tiocmget *tiocmget = serial->tiocmget; | 1653 | struct hso_tiocmget *tiocmget = serial->tiocmget; |
1654 | 1654 | ||
1655 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | 1655 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); |
@@ -1660,19 +1660,19 @@ static int hso_get_count(struct hso_serial *serial, | |||
1660 | memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount)); | 1660 | memcpy(&cnow, &tiocmget->icount, sizeof(struct uart_icount)); |
1661 | spin_unlock_irq(&serial->serial_lock); | 1661 | spin_unlock_irq(&serial->serial_lock); |
1662 | 1662 | ||
1663 | icount.cts = cnow.cts; | 1663 | icount->cts = cnow.cts; |
1664 | icount.dsr = cnow.dsr; | 1664 | icount->dsr = cnow.dsr; |
1665 | icount.rng = cnow.rng; | 1665 | icount->rng = cnow.rng; |
1666 | icount.dcd = cnow.dcd; | 1666 | icount->dcd = cnow.dcd; |
1667 | icount.rx = cnow.rx; | 1667 | icount->rx = cnow.rx; |
1668 | icount.tx = cnow.tx; | 1668 | icount->tx = cnow.tx; |
1669 | icount.frame = cnow.frame; | 1669 | icount->frame = cnow.frame; |
1670 | icount.overrun = cnow.overrun; | 1670 | icount->overrun = cnow.overrun; |
1671 | icount.parity = cnow.parity; | 1671 | icount->parity = cnow.parity; |
1672 | icount.brk = cnow.brk; | 1672 | icount->brk = cnow.brk; |
1673 | icount.buf_overrun = cnow.buf_overrun; | 1673 | icount->buf_overrun = cnow.buf_overrun; |
1674 | 1674 | ||
1675 | return copy_to_user(icnt, &icount, sizeof(icount)) ? -EFAULT : 0; | 1675 | return 0; |
1676 | } | 1676 | } |
1677 | 1677 | ||
1678 | 1678 | ||
@@ -1764,10 +1764,6 @@ static int hso_serial_ioctl(struct tty_struct *tty, struct file *file, | |||
1764 | case TIOCMIWAIT: | 1764 | case TIOCMIWAIT: |
1765 | ret = hso_wait_modem_status(serial, arg); | 1765 | ret = hso_wait_modem_status(serial, arg); |
1766 | break; | 1766 | break; |
1767 | |||
1768 | case TIOCGICOUNT: | ||
1769 | ret = hso_get_count(serial, uarg); | ||
1770 | break; | ||
1771 | default: | 1767 | default: |
1772 | ret = -ENOIOCTLCMD; | 1768 | ret = -ENOIOCTLCMD; |
1773 | break; | 1769 | break; |
@@ -3300,6 +3296,7 @@ static const struct tty_operations hso_serial_ops = { | |||
3300 | .chars_in_buffer = hso_serial_chars_in_buffer, | 3296 | .chars_in_buffer = hso_serial_chars_in_buffer, |
3301 | .tiocmget = hso_serial_tiocmget, | 3297 | .tiocmget = hso_serial_tiocmget, |
3302 | .tiocmset = hso_serial_tiocmset, | 3298 | .tiocmset = hso_serial_tiocmset, |
3299 | .get_icount = hso_get_count, | ||
3303 | .unthrottle = hso_unthrottle | 3300 | .unthrottle = hso_unthrottle |
3304 | }; | 3301 | }; |
3305 | 3302 | ||
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 4e41a2a39422..8f1d4fb19d24 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -411,6 +411,26 @@ err_out: | |||
411 | return result; | 411 | return result; |
412 | } | 412 | } |
413 | 413 | ||
414 | static int ark3116_get_icount(struct tty_struct *tty, | ||
415 | struct serial_icounter_struct *icount) | ||
416 | { | ||
417 | struct usb_serial_port *port = tty->driver_data; | ||
418 | struct ark3116_private *priv = usb_get_serial_port_data(port); | ||
419 | struct async_icount cnow = priv->icount; | ||
420 | icount->cts = cnow.cts; | ||
421 | icount->dsr = cnow.dsr; | ||
422 | icount->rng = cnow.rng; | ||
423 | icount->dcd = cnow.dcd; | ||
424 | icount->rx = cnow.rx; | ||
425 | icount->tx = cnow.tx; | ||
426 | icount->frame = cnow.frame; | ||
427 | icount->overrun = cnow.overrun; | ||
428 | icount->parity = cnow.parity; | ||
429 | icount->brk = cnow.brk; | ||
430 | icount->buf_overrun = cnow.buf_overrun; | ||
431 | return 0; | ||
432 | } | ||
433 | |||
414 | static int ark3116_ioctl(struct tty_struct *tty, struct file *file, | 434 | static int ark3116_ioctl(struct tty_struct *tty, struct file *file, |
415 | unsigned int cmd, unsigned long arg) | 435 | unsigned int cmd, unsigned long arg) |
416 | { | 436 | { |
@@ -460,25 +480,6 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file, | |||
460 | return 0; | 480 | return 0; |
461 | } | 481 | } |
462 | break; | 482 | break; |
463 | case TIOCGICOUNT: { | ||
464 | struct serial_icounter_struct icount; | ||
465 | struct async_icount cnow = priv->icount; | ||
466 | memset(&icount, 0, sizeof(icount)); | ||
467 | icount.cts = cnow.cts; | ||
468 | icount.dsr = cnow.dsr; | ||
469 | icount.rng = cnow.rng; | ||
470 | icount.dcd = cnow.dcd; | ||
471 | icount.rx = cnow.rx; | ||
472 | icount.tx = cnow.tx; | ||
473 | icount.frame = cnow.frame; | ||
474 | icount.overrun = cnow.overrun; | ||
475 | icount.parity = cnow.parity; | ||
476 | icount.brk = cnow.brk; | ||
477 | icount.buf_overrun = cnow.buf_overrun; | ||
478 | if (copy_to_user(user_arg, &icount, sizeof(icount))) | ||
479 | return -EFAULT; | ||
480 | return 0; | ||
481 | } | ||
482 | } | 483 | } |
483 | 484 | ||
484 | return -ENOIOCTLCMD; | 485 | return -ENOIOCTLCMD; |
@@ -736,6 +737,7 @@ static struct usb_serial_driver ark3116_device = { | |||
736 | .ioctl = ark3116_ioctl, | 737 | .ioctl = ark3116_ioctl, |
737 | .tiocmget = ark3116_tiocmget, | 738 | .tiocmget = ark3116_tiocmget, |
738 | .tiocmset = ark3116_tiocmset, | 739 | .tiocmset = ark3116_tiocmset, |
740 | .get_icount = ark3116_get_icount, | ||
739 | .open = ark3116_open, | 741 | .open = ark3116_open, |
740 | .close = ark3116_close, | 742 | .close = ark3116_close, |
741 | .break_ctl = ark3116_break_ctl, | 743 | .break_ctl = ark3116_break_ctl, |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 97cc87d654ce..891c20e3bb38 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2168,6 +2168,7 @@ static int ftdi_ioctl(struct tty_struct *tty, struct file *file, | |||
2168 | * - mask passed in arg for lines of interest | 2168 | * - mask passed in arg for lines of interest |
2169 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) | 2169 | * (use |'ed TIOCM_RNG/DSR/CD/CTS for masking) |
2170 | * Caller should use TIOCGICOUNT to see which one it was. | 2170 | * Caller should use TIOCGICOUNT to see which one it was. |
2171 | * (except that the driver doesn't support it !) | ||
2171 | * | 2172 | * |
2172 | * This code is borrowed from linux/drivers/char/serial.c | 2173 | * This code is borrowed from linux/drivers/char/serial.c |
2173 | */ | 2174 | */ |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 76e6fb3aab7a..a0ab78ada25e 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -222,6 +222,8 @@ static void edge_break(struct tty_struct *tty, int break_state); | |||
222 | static int edge_tiocmget(struct tty_struct *tty, struct file *file); | 222 | static int edge_tiocmget(struct tty_struct *tty, struct file *file); |
223 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, | 223 | static int edge_tiocmset(struct tty_struct *tty, struct file *file, |
224 | unsigned int set, unsigned int clear); | 224 | unsigned int set, unsigned int clear); |
225 | static int edge_get_icount(struct tty_struct *tty, | ||
226 | struct serial_icounter_struct *icount); | ||
225 | static int edge_startup(struct usb_serial *serial); | 227 | static int edge_startup(struct usb_serial *serial); |
226 | static void edge_disconnect(struct usb_serial *serial); | 228 | static void edge_disconnect(struct usb_serial *serial); |
227 | static void edge_release(struct usb_serial *serial); | 229 | static void edge_release(struct usb_serial *serial); |
@@ -1624,6 +1626,31 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file) | |||
1624 | return result; | 1626 | return result; |
1625 | } | 1627 | } |
1626 | 1628 | ||
1629 | static int edge_get_icount(struct tty_struct *tty, | ||
1630 | struct serial_icounter_struct *icount) | ||
1631 | { | ||
1632 | struct usb_serial_port *port = tty->driver_data; | ||
1633 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | ||
1634 | struct async_icount cnow; | ||
1635 | cnow = edge_port->icount; | ||
1636 | |||
1637 | icount->cts = cnow.cts; | ||
1638 | icount->dsr = cnow.dsr; | ||
1639 | icount->rng = cnow.rng; | ||
1640 | icount->dcd = cnow.dcd; | ||
1641 | icount->rx = cnow.rx; | ||
1642 | icount->tx = cnow.tx; | ||
1643 | icount->frame = cnow.frame; | ||
1644 | icount->overrun = cnow.overrun; | ||
1645 | icount->parity = cnow.parity; | ||
1646 | icount->brk = cnow.brk; | ||
1647 | icount->buf_overrun = cnow.buf_overrun; | ||
1648 | |||
1649 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", | ||
1650 | __func__, port->number, icount->rx, icount->tx); | ||
1651 | return 0; | ||
1652 | } | ||
1653 | |||
1627 | static int get_serial_info(struct edgeport_port *edge_port, | 1654 | static int get_serial_info(struct edgeport_port *edge_port, |
1628 | struct serial_struct __user *retinfo) | 1655 | struct serial_struct __user *retinfo) |
1629 | { | 1656 | { |
@@ -1650,7 +1677,6 @@ static int get_serial_info(struct edgeport_port *edge_port, | |||
1650 | } | 1677 | } |
1651 | 1678 | ||
1652 | 1679 | ||
1653 | |||
1654 | /***************************************************************************** | 1680 | /***************************************************************************** |
1655 | * SerialIoctl | 1681 | * SerialIoctl |
1656 | * this function handles any ioctl calls to the driver | 1682 | * this function handles any ioctl calls to the driver |
@@ -1663,7 +1689,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file, | |||
1663 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 1689 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
1664 | struct async_icount cnow; | 1690 | struct async_icount cnow; |
1665 | struct async_icount cprev; | 1691 | struct async_icount cprev; |
1666 | struct serial_icounter_struct icount; | ||
1667 | 1692 | ||
1668 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); | 1693 | dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); |
1669 | 1694 | ||
@@ -1702,26 +1727,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file, | |||
1702 | /* NOTREACHED */ | 1727 | /* NOTREACHED */ |
1703 | break; | 1728 | break; |
1704 | 1729 | ||
1705 | case TIOCGICOUNT: | ||
1706 | cnow = edge_port->icount; | ||
1707 | memset(&icount, 0, sizeof(icount)); | ||
1708 | icount.cts = cnow.cts; | ||
1709 | icount.dsr = cnow.dsr; | ||
1710 | icount.rng = cnow.rng; | ||
1711 | icount.dcd = cnow.dcd; | ||
1712 | icount.rx = cnow.rx; | ||
1713 | icount.tx = cnow.tx; | ||
1714 | icount.frame = cnow.frame; | ||
1715 | icount.overrun = cnow.overrun; | ||
1716 | icount.parity = cnow.parity; | ||
1717 | icount.brk = cnow.brk; | ||
1718 | icount.buf_overrun = cnow.buf_overrun; | ||
1719 | |||
1720 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", | ||
1721 | __func__, port->number, icount.rx, icount.tx); | ||
1722 | if (copy_to_user((void __user *)arg, &icount, sizeof(icount))) | ||
1723 | return -EFAULT; | ||
1724 | return 0; | ||
1725 | } | 1730 | } |
1726 | return -ENOIOCTLCMD; | 1731 | return -ENOIOCTLCMD; |
1727 | } | 1732 | } |
diff --git a/drivers/usb/serial/io_tables.h b/drivers/usb/serial/io_tables.h index feb56a4ca799..6ab2a3f97fe8 100644 --- a/drivers/usb/serial/io_tables.h +++ b/drivers/usb/serial/io_tables.h | |||
@@ -123,6 +123,7 @@ static struct usb_serial_driver edgeport_2port_device = { | |||
123 | .set_termios = edge_set_termios, | 123 | .set_termios = edge_set_termios, |
124 | .tiocmget = edge_tiocmget, | 124 | .tiocmget = edge_tiocmget, |
125 | .tiocmset = edge_tiocmset, | 125 | .tiocmset = edge_tiocmset, |
126 | .get_icount = edge_get_icount, | ||
126 | .write = edge_write, | 127 | .write = edge_write, |
127 | .write_room = edge_write_room, | 128 | .write_room = edge_write_room, |
128 | .chars_in_buffer = edge_chars_in_buffer, | 129 | .chars_in_buffer = edge_chars_in_buffer, |
@@ -152,6 +153,7 @@ static struct usb_serial_driver edgeport_4port_device = { | |||
152 | .set_termios = edge_set_termios, | 153 | .set_termios = edge_set_termios, |
153 | .tiocmget = edge_tiocmget, | 154 | .tiocmget = edge_tiocmget, |
154 | .tiocmset = edge_tiocmset, | 155 | .tiocmset = edge_tiocmset, |
156 | .get_icount = edge_get_icount, | ||
155 | .write = edge_write, | 157 | .write = edge_write, |
156 | .write_room = edge_write_room, | 158 | .write_room = edge_write_room, |
157 | .chars_in_buffer = edge_chars_in_buffer, | 159 | .chars_in_buffer = edge_chars_in_buffer, |
@@ -181,6 +183,7 @@ static struct usb_serial_driver edgeport_8port_device = { | |||
181 | .set_termios = edge_set_termios, | 183 | .set_termios = edge_set_termios, |
182 | .tiocmget = edge_tiocmget, | 184 | .tiocmget = edge_tiocmget, |
183 | .tiocmset = edge_tiocmset, | 185 | .tiocmset = edge_tiocmset, |
186 | .get_icount = edge_get_icount, | ||
184 | .write = edge_write, | 187 | .write = edge_write, |
185 | .write_room = edge_write_room, | 188 | .write_room = edge_write_room, |
186 | .chars_in_buffer = edge_chars_in_buffer, | 189 | .chars_in_buffer = edge_chars_in_buffer, |
@@ -209,6 +212,7 @@ static struct usb_serial_driver epic_device = { | |||
209 | .set_termios = edge_set_termios, | 212 | .set_termios = edge_set_termios, |
210 | .tiocmget = edge_tiocmget, | 213 | .tiocmget = edge_tiocmget, |
211 | .tiocmset = edge_tiocmset, | 214 | .tiocmset = edge_tiocmset, |
215 | .get_icount = edge_get_icount, | ||
212 | .write = edge_write, | 216 | .write = edge_write, |
213 | .write_room = edge_write_room, | 217 | .write_room = edge_write_room, |
214 | .chars_in_buffer = edge_chars_in_buffer, | 218 | .chars_in_buffer = edge_chars_in_buffer, |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index a7cfc5952937..4dad27a0f22a 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -2510,6 +2510,27 @@ static int edge_tiocmget(struct tty_struct *tty, struct file *file) | |||
2510 | return result; | 2510 | return result; |
2511 | } | 2511 | } |
2512 | 2512 | ||
2513 | static int edge_get_icount(struct tty_struct *tty, | ||
2514 | struct serial_icounter_struct *icount) | ||
2515 | { | ||
2516 | struct usb_serial_port *port = tty->driver_data; | ||
2517 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | ||
2518 | struct async_icount *ic = &edge_port->icount; | ||
2519 | |||
2520 | icount->cts = ic->cts; | ||
2521 | icount->dsr = ic->dsr; | ||
2522 | icount->rng = ic->rng; | ||
2523 | icount->dcd = ic->dcd; | ||
2524 | icount->tx = ic->tx; | ||
2525 | icount->rx = ic->rx; | ||
2526 | icount->frame = ic->frame; | ||
2527 | icount->parity = ic->parity; | ||
2528 | icount->overrun = ic->overrun; | ||
2529 | icount->brk = ic->brk; | ||
2530 | icount->buf_overrun = ic->buf_overrun; | ||
2531 | return 0; | ||
2532 | } | ||
2533 | |||
2513 | static int get_serial_info(struct edgeport_port *edge_port, | 2534 | static int get_serial_info(struct edgeport_port *edge_port, |
2514 | struct serial_struct __user *retinfo) | 2535 | struct serial_struct __user *retinfo) |
2515 | { | 2536 | { |
@@ -2572,13 +2593,6 @@ static int edge_ioctl(struct tty_struct *tty, struct file *file, | |||
2572 | } | 2593 | } |
2573 | /* not reached */ | 2594 | /* not reached */ |
2574 | break; | 2595 | break; |
2575 | case TIOCGICOUNT: | ||
2576 | dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
2577 | port->number, edge_port->icount.rx, edge_port->icount.tx); | ||
2578 | if (copy_to_user((void __user *)arg, &edge_port->icount, | ||
2579 | sizeof(edge_port->icount))) | ||
2580 | return -EFAULT; | ||
2581 | return 0; | ||
2582 | } | 2596 | } |
2583 | return -ENOIOCTLCMD; | 2597 | return -ENOIOCTLCMD; |
2584 | } | 2598 | } |
@@ -2758,6 +2772,7 @@ static struct usb_serial_driver edgeport_1port_device = { | |||
2758 | .set_termios = edge_set_termios, | 2772 | .set_termios = edge_set_termios, |
2759 | .tiocmget = edge_tiocmget, | 2773 | .tiocmget = edge_tiocmget, |
2760 | .tiocmset = edge_tiocmset, | 2774 | .tiocmset = edge_tiocmset, |
2775 | .get_icount = edge_get_icount, | ||
2761 | .write = edge_write, | 2776 | .write = edge_write, |
2762 | .write_room = edge_write_room, | 2777 | .write_room = edge_write_room, |
2763 | .chars_in_buffer = edge_chars_in_buffer, | 2778 | .chars_in_buffer = edge_chars_in_buffer, |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index aa665817a272..fd0b6414f459 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -1896,10 +1896,37 @@ static int mos7720_tiocmset(struct tty_struct *tty, struct file *file, | |||
1896 | return 0; | 1896 | return 0; |
1897 | } | 1897 | } |
1898 | 1898 | ||
1899 | static int mos7720_get_icount(struct tty_struct *tty, | ||
1900 | struct serial_icounter_struct *icount) | ||
1901 | { | ||
1902 | struct usb_serial_port *port = tty->driver_data; | ||
1903 | struct moschip_port *mos7720_port; | ||
1904 | struct async_icount cnow; | ||
1905 | |||
1906 | mos7720_port = usb_get_serial_port_data(port); | ||
1907 | cnow = mos7720_port->icount; | ||
1908 | |||
1909 | icount->cts = cnow.cts; | ||
1910 | icount->dsr = cnow.dsr; | ||
1911 | icount->rng = cnow.rng; | ||
1912 | icount->dcd = cnow.dcd; | ||
1913 | icount->rx = cnow.rx; | ||
1914 | icount->tx = cnow.tx; | ||
1915 | icount->frame = cnow.frame; | ||
1916 | icount->overrun = cnow.overrun; | ||
1917 | icount->parity = cnow.parity; | ||
1918 | icount->brk = cnow.brk; | ||
1919 | icount->buf_overrun = cnow.buf_overrun; | ||
1920 | |||
1921 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
1922 | port->number, icount->rx, icount->tx); | ||
1923 | return 0; | ||
1924 | } | ||
1925 | |||
1899 | static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, | 1926 | static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, |
1900 | unsigned int __user *value) | 1927 | unsigned int __user *value) |
1901 | { | 1928 | { |
1902 | unsigned int mcr ; | 1929 | unsigned int mcr; |
1903 | unsigned int arg; | 1930 | unsigned int arg; |
1904 | 1931 | ||
1905 | struct usb_serial_port *port; | 1932 | struct usb_serial_port *port; |
@@ -1973,7 +2000,6 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file, | |||
1973 | struct moschip_port *mos7720_port; | 2000 | struct moschip_port *mos7720_port; |
1974 | struct async_icount cnow; | 2001 | struct async_icount cnow; |
1975 | struct async_icount cprev; | 2002 | struct async_icount cprev; |
1976 | struct serial_icounter_struct icount; | ||
1977 | 2003 | ||
1978 | mos7720_port = usb_get_serial_port_data(port); | 2004 | mos7720_port = usb_get_serial_port_data(port); |
1979 | if (mos7720_port == NULL) | 2005 | if (mos7720_port == NULL) |
@@ -2021,29 +2047,6 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file, | |||
2021 | } | 2047 | } |
2022 | /* NOTREACHED */ | 2048 | /* NOTREACHED */ |
2023 | break; | 2049 | break; |
2024 | |||
2025 | case TIOCGICOUNT: | ||
2026 | cnow = mos7720_port->icount; | ||
2027 | |||
2028 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
2029 | |||
2030 | icount.cts = cnow.cts; | ||
2031 | icount.dsr = cnow.dsr; | ||
2032 | icount.rng = cnow.rng; | ||
2033 | icount.dcd = cnow.dcd; | ||
2034 | icount.rx = cnow.rx; | ||
2035 | icount.tx = cnow.tx; | ||
2036 | icount.frame = cnow.frame; | ||
2037 | icount.overrun = cnow.overrun; | ||
2038 | icount.parity = cnow.parity; | ||
2039 | icount.brk = cnow.brk; | ||
2040 | icount.buf_overrun = cnow.buf_overrun; | ||
2041 | |||
2042 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
2043 | port->number, icount.rx, icount.tx); | ||
2044 | if (copy_to_user((void __user *)arg, &icount, sizeof(icount))) | ||
2045 | return -EFAULT; | ||
2046 | return 0; | ||
2047 | } | 2050 | } |
2048 | 2051 | ||
2049 | return -ENOIOCTLCMD; | 2052 | return -ENOIOCTLCMD; |
@@ -2212,6 +2215,7 @@ static struct usb_serial_driver moschip7720_2port_driver = { | |||
2212 | .ioctl = mos7720_ioctl, | 2215 | .ioctl = mos7720_ioctl, |
2213 | .tiocmget = mos7720_tiocmget, | 2216 | .tiocmget = mos7720_tiocmget, |
2214 | .tiocmset = mos7720_tiocmset, | 2217 | .tiocmset = mos7720_tiocmset, |
2218 | .get_icount = mos7720_get_icount, | ||
2215 | .set_termios = mos7720_set_termios, | 2219 | .set_termios = mos7720_set_termios, |
2216 | .write = mos7720_write, | 2220 | .write = mos7720_write, |
2217 | .write_room = mos7720_write_room, | 2221 | .write_room = mos7720_write_room, |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 1a42bc213799..93dad5853cd5 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -2209,6 +2209,34 @@ static int mos7840_get_serial_info(struct moschip_port *mos7840_port, | |||
2209 | return 0; | 2209 | return 0; |
2210 | } | 2210 | } |
2211 | 2211 | ||
2212 | static int mos7840_get_icount(struct tty_struct *tty, | ||
2213 | struct serial_icounter_struct *icount) | ||
2214 | { | ||
2215 | struct usb_serial_port *port = tty->driver_data; | ||
2216 | struct moschip_port *mos7840_port; | ||
2217 | struct async_icount cnow; | ||
2218 | |||
2219 | mos7840_port = mos7840_get_port_private(port); | ||
2220 | cnow = mos7840_port->icount; | ||
2221 | |||
2222 | smp_rmb(); | ||
2223 | icount->cts = cnow.cts; | ||
2224 | icount->dsr = cnow.dsr; | ||
2225 | icount->rng = cnow.rng; | ||
2226 | icount->dcd = cnow.dcd; | ||
2227 | icount->rx = cnow.rx; | ||
2228 | icount->tx = cnow.tx; | ||
2229 | icount->frame = cnow.frame; | ||
2230 | icount->overrun = cnow.overrun; | ||
2231 | icount->parity = cnow.parity; | ||
2232 | icount->brk = cnow.brk; | ||
2233 | icount->buf_overrun = cnow.buf_overrun; | ||
2234 | |||
2235 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
2236 | port->number, icount->rx, icount->tx); | ||
2237 | return 0; | ||
2238 | } | ||
2239 | |||
2212 | /***************************************************************************** | 2240 | /***************************************************************************** |
2213 | * SerialIoctl | 2241 | * SerialIoctl |
2214 | * this function handles any ioctl calls to the driver | 2242 | * this function handles any ioctl calls to the driver |
@@ -2223,7 +2251,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | |||
2223 | 2251 | ||
2224 | struct async_icount cnow; | 2252 | struct async_icount cnow; |
2225 | struct async_icount cprev; | 2253 | struct async_icount cprev; |
2226 | struct serial_icounter_struct icount; | ||
2227 | 2254 | ||
2228 | if (mos7840_port_paranoia_check(port, __func__)) { | 2255 | if (mos7840_port_paranoia_check(port, __func__)) { |
2229 | dbg("%s", "Invalid port"); | 2256 | dbg("%s", "Invalid port"); |
@@ -2282,29 +2309,6 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | |||
2282 | /* NOTREACHED */ | 2309 | /* NOTREACHED */ |
2283 | break; | 2310 | break; |
2284 | 2311 | ||
2285 | case TIOCGICOUNT: | ||
2286 | cnow = mos7840_port->icount; | ||
2287 | smp_rmb(); | ||
2288 | |||
2289 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
2290 | |||
2291 | icount.cts = cnow.cts; | ||
2292 | icount.dsr = cnow.dsr; | ||
2293 | icount.rng = cnow.rng; | ||
2294 | icount.dcd = cnow.dcd; | ||
2295 | icount.rx = cnow.rx; | ||
2296 | icount.tx = cnow.tx; | ||
2297 | icount.frame = cnow.frame; | ||
2298 | icount.overrun = cnow.overrun; | ||
2299 | icount.parity = cnow.parity; | ||
2300 | icount.brk = cnow.brk; | ||
2301 | icount.buf_overrun = cnow.buf_overrun; | ||
2302 | |||
2303 | dbg("%s (%d) TIOCGICOUNT RX=%d, TX=%d", __func__, | ||
2304 | port->number, icount.rx, icount.tx); | ||
2305 | if (copy_to_user(argp, &icount, sizeof(icount))) | ||
2306 | return -EFAULT; | ||
2307 | return 0; | ||
2308 | default: | 2312 | default: |
2309 | break; | 2313 | break; |
2310 | } | 2314 | } |
@@ -2674,6 +2678,7 @@ static struct usb_serial_driver moschip7840_4port_device = { | |||
2674 | .break_ctl = mos7840_break, | 2678 | .break_ctl = mos7840_break, |
2675 | .tiocmget = mos7840_tiocmget, | 2679 | .tiocmget = mos7840_tiocmget, |
2676 | .tiocmset = mos7840_tiocmset, | 2680 | .tiocmset = mos7840_tiocmset, |
2681 | .get_icount = mos7840_get_icount, | ||
2677 | .attach = mos7840_startup, | 2682 | .attach = mos7840_startup, |
2678 | .disconnect = mos7840_disconnect, | 2683 | .disconnect = mos7840_disconnect, |
2679 | .release = mos7840_release, | 2684 | .release = mos7840_release, |
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index e986002b3844..8bd60e3c8b28 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -416,6 +416,30 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
416 | return 0; | 416 | return 0; |
417 | } | 417 | } |
418 | 418 | ||
419 | static int ssu100_get_icount(struct tty_struct *tty, | ||
420 | struct serial_icounter_struct *icount) | ||
421 | { | ||
422 | struct usb_serial_port *port = tty->driver_data; | ||
423 | struct ssu100_port_private *priv = usb_get_serial_port_data(port); | ||
424 | struct async_icount cnow = priv->icount; | ||
425 | |||
426 | icount->cts = cnow.cts; | ||
427 | icount->dsr = cnow.dsr; | ||
428 | icount->rng = cnow.rng; | ||
429 | icount->dcd = cnow.dcd; | ||
430 | icount->rx = cnow.rx; | ||
431 | icount->tx = cnow.tx; | ||
432 | icount->frame = cnow.frame; | ||
433 | icount->overrun = cnow.overrun; | ||
434 | icount->parity = cnow.parity; | ||
435 | icount->brk = cnow.brk; | ||
436 | icount->buf_overrun = cnow.buf_overrun; | ||
437 | |||
438 | return 0; | ||
439 | } | ||
440 | |||
441 | |||
442 | |||
419 | static int ssu100_ioctl(struct tty_struct *tty, struct file *file, | 443 | static int ssu100_ioctl(struct tty_struct *tty, struct file *file, |
420 | unsigned int cmd, unsigned long arg) | 444 | unsigned int cmd, unsigned long arg) |
421 | { | 445 | { |
@@ -433,27 +457,6 @@ static int ssu100_ioctl(struct tty_struct *tty, struct file *file, | |||
433 | case TIOCMIWAIT: | 457 | case TIOCMIWAIT: |
434 | return wait_modem_info(port, arg); | 458 | return wait_modem_info(port, arg); |
435 | 459 | ||
436 | case TIOCGICOUNT: | ||
437 | { | ||
438 | struct serial_icounter_struct icount; | ||
439 | struct async_icount cnow = priv->icount; | ||
440 | memset(&icount, 0, sizeof(icount)); | ||
441 | icount.cts = cnow.cts; | ||
442 | icount.dsr = cnow.dsr; | ||
443 | icount.rng = cnow.rng; | ||
444 | icount.dcd = cnow.dcd; | ||
445 | icount.rx = cnow.rx; | ||
446 | icount.tx = cnow.tx; | ||
447 | icount.frame = cnow.frame; | ||
448 | icount.overrun = cnow.overrun; | ||
449 | icount.parity = cnow.parity; | ||
450 | icount.brk = cnow.brk; | ||
451 | icount.buf_overrun = cnow.buf_overrun; | ||
452 | if (copy_to_user(user_arg, &icount, sizeof(icount))) | ||
453 | return -EFAULT; | ||
454 | return 0; | ||
455 | } | ||
456 | |||
457 | default: | 460 | default: |
458 | break; | 461 | break; |
459 | } | 462 | } |
@@ -726,6 +729,7 @@ static struct usb_serial_driver ssu100_device = { | |||
726 | .process_read_urb = ssu100_process_read_urb, | 729 | .process_read_urb = ssu100_process_read_urb, |
727 | .tiocmget = ssu100_tiocmget, | 730 | .tiocmget = ssu100_tiocmget, |
728 | .tiocmset = ssu100_tiocmset, | 731 | .tiocmset = ssu100_tiocmset, |
732 | .get_icount = ssu100_get_icount, | ||
729 | .ioctl = ssu100_ioctl, | 733 | .ioctl = ssu100_ioctl, |
730 | .set_termios = ssu100_set_termios, | 734 | .set_termios = ssu100_set_termios, |
731 | .disconnect = usb_serial_generic_disconnect, | 735 | .disconnect = usb_serial_generic_disconnect, |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 90979a1f5311..b2902f307b47 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -108,6 +108,8 @@ static void ti_throttle(struct tty_struct *tty); | |||
108 | static void ti_unthrottle(struct tty_struct *tty); | 108 | static void ti_unthrottle(struct tty_struct *tty); |
109 | static int ti_ioctl(struct tty_struct *tty, struct file *file, | 109 | static int ti_ioctl(struct tty_struct *tty, struct file *file, |
110 | unsigned int cmd, unsigned long arg); | 110 | unsigned int cmd, unsigned long arg); |
111 | static int ti_get_icount(struct tty_struct *tty, | ||
112 | struct serial_icounter_struct *icount); | ||
111 | static void ti_set_termios(struct tty_struct *tty, | 113 | static void ti_set_termios(struct tty_struct *tty, |
112 | struct usb_serial_port *port, struct ktermios *old_termios); | 114 | struct usb_serial_port *port, struct ktermios *old_termios); |
113 | static int ti_tiocmget(struct tty_struct *tty, struct file *file); | 115 | static int ti_tiocmget(struct tty_struct *tty, struct file *file); |
@@ -237,6 +239,7 @@ static struct usb_serial_driver ti_1port_device = { | |||
237 | .set_termios = ti_set_termios, | 239 | .set_termios = ti_set_termios, |
238 | .tiocmget = ti_tiocmget, | 240 | .tiocmget = ti_tiocmget, |
239 | .tiocmset = ti_tiocmset, | 241 | .tiocmset = ti_tiocmset, |
242 | .get_icount = ti_get_icount, | ||
240 | .break_ctl = ti_break, | 243 | .break_ctl = ti_break, |
241 | .read_int_callback = ti_interrupt_callback, | 244 | .read_int_callback = ti_interrupt_callback, |
242 | .read_bulk_callback = ti_bulk_in_callback, | 245 | .read_bulk_callback = ti_bulk_in_callback, |
@@ -265,6 +268,7 @@ static struct usb_serial_driver ti_2port_device = { | |||
265 | .set_termios = ti_set_termios, | 268 | .set_termios = ti_set_termios, |
266 | .tiocmget = ti_tiocmget, | 269 | .tiocmget = ti_tiocmget, |
267 | .tiocmset = ti_tiocmset, | 270 | .tiocmset = ti_tiocmset, |
271 | .get_icount = ti_get_icount, | ||
268 | .break_ctl = ti_break, | 272 | .break_ctl = ti_break, |
269 | .read_int_callback = ti_interrupt_callback, | 273 | .read_int_callback = ti_interrupt_callback, |
270 | .read_bulk_callback = ti_bulk_in_callback, | 274 | .read_bulk_callback = ti_bulk_in_callback, |
@@ -788,6 +792,31 @@ static void ti_unthrottle(struct tty_struct *tty) | |||
788 | } | 792 | } |
789 | } | 793 | } |
790 | 794 | ||
795 | static int ti_get_icount(struct tty_struct *tty, | ||
796 | struct serial_icounter_struct *icount) | ||
797 | { | ||
798 | struct usb_serial_port *port = tty->driver_data; | ||
799 | struct ti_port *tport = usb_get_serial_port_data(port); | ||
800 | struct async_icount cnow = tport->tp_icount; | ||
801 | |||
802 | dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", | ||
803 | __func__, port->number, | ||
804 | cnow.rx, cnow.tx); | ||
805 | |||
806 | icount->cts = cnow.cts; | ||
807 | icount->dsr = cnow.dsr; | ||
808 | icount->rng = cnow.rng; | ||
809 | icount->dcd = cnow.dcd; | ||
810 | icount->rx = cnow.rx; | ||
811 | icount->tx = cnow.tx; | ||
812 | icount->frame = cnow.frame; | ||
813 | icount->overrun = cnow.overrun; | ||
814 | icount->parity = cnow.parity; | ||
815 | icount->brk = cnow.brk; | ||
816 | icount->buf_overrun = cnow.buf_overrun; | ||
817 | |||
818 | return 0; | ||
819 | } | ||
791 | 820 | ||
792 | static int ti_ioctl(struct tty_struct *tty, struct file *file, | 821 | static int ti_ioctl(struct tty_struct *tty, struct file *file, |
793 | unsigned int cmd, unsigned long arg) | 822 | unsigned int cmd, unsigned long arg) |
@@ -830,14 +859,6 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file, | |||
830 | cprev = cnow; | 859 | cprev = cnow; |
831 | } | 860 | } |
832 | break; | 861 | break; |
833 | case TIOCGICOUNT: | ||
834 | dbg("%s - (%d) TIOCGICOUNT RX=%d, TX=%d", | ||
835 | __func__, port->number, | ||
836 | tport->tp_icount.rx, tport->tp_icount.tx); | ||
837 | if (copy_to_user((void __user *)arg, &tport->tp_icount, | ||
838 | sizeof(tport->tp_icount))) | ||
839 | return -EFAULT; | ||
840 | return 0; | ||
841 | } | 862 | } |
842 | return -ENOIOCTLCMD; | 863 | return -ENOIOCTLCMD; |
843 | } | 864 | } |