aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:37:22 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:52:25 -0400
commit0a4142fb9ceddb7e8c48570431038a91bbee7c7c (patch)
tree362d913521b425d948d17891ba35aaa131dd69da /drivers/usb
parent6d0cad657a133818038683120fff9c5c5f8dc751 (diff)
USB: quatech2: switch to generic get_icount implementation
Switch to the generic get_icount implementation. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/quatech2.c51
1 files changed, 12 insertions, 39 deletions
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index 80a8bc30a871..3506a2c5e4e9 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -128,8 +128,6 @@ struct qt2_port_private {
128 u8 shadowLSR; 128 u8 shadowLSR;
129 u8 shadowMSR; 129 u8 shadowMSR;
130 130
131 struct async_icount icount;
132
133 struct usb_serial_port *port; 131 struct usb_serial_port *port;
134}; 132};
135 133
@@ -501,16 +499,16 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
501 unsigned long flags; 499 unsigned long flags;
502 500
503 spin_lock_irqsave(&priv->lock, flags); 501 spin_lock_irqsave(&priv->lock, flags);
504 prev = priv->icount; 502 prev = port->icount;
505 spin_unlock_irqrestore(&priv->lock, flags); 503 spin_unlock_irqrestore(&priv->lock, flags);
506 504
507 while (1) { 505 while (1) {
508 wait_event_interruptible(port->delta_msr_wait, 506 wait_event_interruptible(port->delta_msr_wait,
509 (port->serial->disconnected || 507 (port->serial->disconnected ||
510 (priv->icount.rng != prev.rng) || 508 (port->icount.rng != prev.rng) ||
511 (priv->icount.dsr != prev.dsr) || 509 (port->icount.dsr != prev.dsr) ||
512 (priv->icount.dcd != prev.dcd) || 510 (port->icount.dcd != prev.dcd) ||
513 (priv->icount.cts != prev.cts))); 511 (port->icount.cts != prev.cts)));
514 512
515 if (signal_pending(current)) 513 if (signal_pending(current))
516 return -ERESTARTSYS; 514 return -ERESTARTSYS;
@@ -519,7 +517,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
519 return -EIO; 517 return -EIO;
520 518
521 spin_lock_irqsave(&priv->lock, flags); 519 spin_lock_irqsave(&priv->lock, flags);
522 cur = priv->icount; 520 cur = port->icount;
523 spin_unlock_irqrestore(&priv->lock, flags); 521 spin_unlock_irqrestore(&priv->lock, flags);
524 522
525 if ((prev.rng == cur.rng) && 523 if ((prev.rng == cur.rng) &&
@@ -537,28 +535,6 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg)
537 return 0; 535 return 0;
538} 536}
539 537
540static int qt2_get_icount(struct tty_struct *tty,
541 struct serial_icounter_struct *icount)
542{
543 struct usb_serial_port *port = tty->driver_data;
544 struct qt2_port_private *priv = usb_get_serial_port_data(port);
545 struct async_icount cnow = priv->icount;
546
547 icount->cts = cnow.cts;
548 icount->dsr = cnow.dsr;
549 icount->rng = cnow.rng;
550 icount->dcd = cnow.dcd;
551 icount->rx = cnow.rx;
552 icount->tx = cnow.tx;
553 icount->frame = cnow.frame;
554 icount->overrun = cnow.overrun;
555 icount->parity = cnow.parity;
556 icount->brk = cnow.brk;
557 icount->buf_overrun = cnow.buf_overrun;
558
559 return 0;
560}
561
562static int qt2_ioctl(struct tty_struct *tty, 538static int qt2_ioctl(struct tty_struct *tty,
563 unsigned int cmd, unsigned long arg) 539 unsigned int cmd, unsigned long arg)
564{ 540{
@@ -958,16 +934,13 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)
958 if (newMSR & UART_MSR_ANY_DELTA) { 934 if (newMSR & UART_MSR_ANY_DELTA) {
959 /* update input line counters */ 935 /* update input line counters */
960 if (newMSR & UART_MSR_DCTS) 936 if (newMSR & UART_MSR_DCTS)
961 port_priv->icount.cts++; 937 port->icount.cts++;
962
963 if (newMSR & UART_MSR_DDSR) 938 if (newMSR & UART_MSR_DDSR)
964 port_priv->icount.dsr++; 939 port->icount.dsr++;
965
966 if (newMSR & UART_MSR_DDCD) 940 if (newMSR & UART_MSR_DDCD)
967 port_priv->icount.dcd++; 941 port->icount.dcd++;
968
969 if (newMSR & UART_MSR_TERI) 942 if (newMSR & UART_MSR_TERI)
970 port_priv->icount.rng++; 943 port->icount.rng++;
971 944
972 wake_up_interruptible(&port->delta_msr_wait); 945 wake_up_interruptible(&port->delta_msr_wait);
973 } 946 }
@@ -989,7 +962,7 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch)
989 port_priv->shadowLSR = newLSR; 962 port_priv->shadowLSR = newLSR;
990 spin_unlock_irqrestore(&port_priv->lock, flags); 963 spin_unlock_irqrestore(&port_priv->lock, flags);
991 964
992 icount = &port_priv->icount; 965 icount = &port->icount;
993 966
994 if (newLSR & UART_LSR_BRK_ERROR_BITS) { 967 if (newLSR & UART_LSR_BRK_ERROR_BITS) {
995 968
@@ -1099,7 +1072,7 @@ static struct usb_serial_driver qt2_device = {
1099 .break_ctl = qt2_break_ctl, 1072 .break_ctl = qt2_break_ctl,
1100 .tiocmget = qt2_tiocmget, 1073 .tiocmget = qt2_tiocmget,
1101 .tiocmset = qt2_tiocmset, 1074 .tiocmset = qt2_tiocmset,
1102 .get_icount = qt2_get_icount, 1075 .get_icount = usb_serial_generic_get_icount,
1103 .ioctl = qt2_ioctl, 1076 .ioctl = qt2_ioctl,
1104 .set_termios = qt2_set_termios, 1077 .set_termios = qt2_set_termios,
1105}; 1078};