aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:36:58 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:50:51 -0400
commitb4cb7536cc4883fe133de8733430ccdb23e23fa9 (patch)
treea6513c21503c10829604da89f386896bf9928969 /drivers/usb/serial
parent6f86fec9fa38b8f69902f973e0cff612b2a0f0b0 (diff)
USB: ark3116: 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/serial')
-rw-r--r--drivers/usb/serial/ark3116.c58
1 files changed, 18 insertions, 40 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 3b811feb35fd..ed3f6b884073 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -62,7 +62,6 @@ static int is_irda(struct usb_serial *serial)
62} 62}
63 63
64struct ark3116_private { 64struct ark3116_private {
65 struct async_icount icount;
66 int irda; /* 1 for irda device */ 65 int irda; /* 1 for irda device */
67 66
68 /* protects hw register updates */ 67 /* protects hw register updates */
@@ -402,31 +401,10 @@ err_out:
402 return result; 401 return result;
403} 402}
404 403
405static int ark3116_get_icount(struct tty_struct *tty,
406 struct serial_icounter_struct *icount)
407{
408 struct usb_serial_port *port = tty->driver_data;
409 struct ark3116_private *priv = usb_get_serial_port_data(port);
410 struct async_icount cnow = priv->icount;
411 icount->cts = cnow.cts;
412 icount->dsr = cnow.dsr;
413 icount->rng = cnow.rng;
414 icount->dcd = cnow.dcd;
415 icount->rx = cnow.rx;
416 icount->tx = cnow.tx;
417 icount->frame = cnow.frame;
418 icount->overrun = cnow.overrun;
419 icount->parity = cnow.parity;
420 icount->brk = cnow.brk;
421 icount->buf_overrun = cnow.buf_overrun;
422 return 0;
423}
424
425static int ark3116_ioctl(struct tty_struct *tty, 404static int ark3116_ioctl(struct tty_struct *tty,
426 unsigned int cmd, unsigned long arg) 405 unsigned int cmd, unsigned long arg)
427{ 406{
428 struct usb_serial_port *port = tty->driver_data; 407 struct usb_serial_port *port = tty->driver_data;
429 struct ark3116_private *priv = usb_get_serial_port_data(port);
430 struct serial_struct serstruct; 408 struct serial_struct serstruct;
431 void __user *user_arg = (void __user *)arg; 409 void __user *user_arg = (void __user *)arg;
432 410
@@ -450,7 +428,7 @@ static int ark3116_ioctl(struct tty_struct *tty,
450 return 0; 428 return 0;
451 case TIOCMIWAIT: 429 case TIOCMIWAIT:
452 for (;;) { 430 for (;;) {
453 struct async_icount prev = priv->icount; 431 struct async_icount prev = port->icount;
454 interruptible_sleep_on(&port->delta_msr_wait); 432 interruptible_sleep_on(&port->delta_msr_wait);
455 /* see if a signal did it */ 433 /* see if a signal did it */
456 if (signal_pending(current)) 434 if (signal_pending(current))
@@ -459,19 +437,19 @@ static int ark3116_ioctl(struct tty_struct *tty,
459 if (port->serial->disconnected) 437 if (port->serial->disconnected)
460 return -EIO; 438 return -EIO;
461 439
462 if ((prev.rng == priv->icount.rng) && 440 if ((prev.rng == port->icount.rng) &&
463 (prev.dsr == priv->icount.dsr) && 441 (prev.dsr == port->icount.dsr) &&
464 (prev.dcd == priv->icount.dcd) && 442 (prev.dcd == port->icount.dcd) &&
465 (prev.cts == priv->icount.cts)) 443 (prev.cts == port->icount.cts))
466 return -EIO; 444 return -EIO;
467 if ((arg & TIOCM_RNG && 445 if ((arg & TIOCM_RNG &&
468 (prev.rng != priv->icount.rng)) || 446 (prev.rng != port->icount.rng)) ||
469 (arg & TIOCM_DSR && 447 (arg & TIOCM_DSR &&
470 (prev.dsr != priv->icount.dsr)) || 448 (prev.dsr != port->icount.dsr)) ||
471 (arg & TIOCM_CD && 449 (arg & TIOCM_CD &&
472 (prev.dcd != priv->icount.dcd)) || 450 (prev.dcd != port->icount.dcd)) ||
473 (arg & TIOCM_CTS && 451 (arg & TIOCM_CTS &&
474 (prev.cts != priv->icount.cts))) 452 (prev.cts != port->icount.cts)))
475 return 0; 453 return 0;
476 } 454 }
477 break; 455 break;
@@ -572,13 +550,13 @@ static void ark3116_update_msr(struct usb_serial_port *port, __u8 msr)
572 if (msr & UART_MSR_ANY_DELTA) { 550 if (msr & UART_MSR_ANY_DELTA) {
573 /* update input line counters */ 551 /* update input line counters */
574 if (msr & UART_MSR_DCTS) 552 if (msr & UART_MSR_DCTS)
575 priv->icount.cts++; 553 port->icount.cts++;
576 if (msr & UART_MSR_DDSR) 554 if (msr & UART_MSR_DDSR)
577 priv->icount.dsr++; 555 port->icount.dsr++;
578 if (msr & UART_MSR_DDCD) 556 if (msr & UART_MSR_DDCD)
579 priv->icount.dcd++; 557 port->icount.dcd++;
580 if (msr & UART_MSR_TERI) 558 if (msr & UART_MSR_TERI)
581 priv->icount.rng++; 559 port->icount.rng++;
582 wake_up_interruptible(&port->delta_msr_wait); 560 wake_up_interruptible(&port->delta_msr_wait);
583 } 561 }
584} 562}
@@ -595,13 +573,13 @@ static void ark3116_update_lsr(struct usb_serial_port *port, __u8 lsr)
595 573
596 if (lsr&UART_LSR_BRK_ERROR_BITS) { 574 if (lsr&UART_LSR_BRK_ERROR_BITS) {
597 if (lsr & UART_LSR_BI) 575 if (lsr & UART_LSR_BI)
598 priv->icount.brk++; 576 port->icount.brk++;
599 if (lsr & UART_LSR_FE) 577 if (lsr & UART_LSR_FE)
600 priv->icount.frame++; 578 port->icount.frame++;
601 if (lsr & UART_LSR_PE) 579 if (lsr & UART_LSR_PE)
602 priv->icount.parity++; 580 port->icount.parity++;
603 if (lsr & UART_LSR_OE) 581 if (lsr & UART_LSR_OE)
604 priv->icount.overrun++; 582 port->icount.overrun++;
605 } 583 }
606} 584}
607 585
@@ -719,7 +697,7 @@ static struct usb_serial_driver ark3116_device = {
719 .ioctl = ark3116_ioctl, 697 .ioctl = ark3116_ioctl,
720 .tiocmget = ark3116_tiocmget, 698 .tiocmget = ark3116_tiocmget,
721 .tiocmset = ark3116_tiocmset, 699 .tiocmset = ark3116_tiocmset,
722 .get_icount = ark3116_get_icount, 700 .get_icount = usb_serial_generic_get_icount,
723 .open = ark3116_open, 701 .open = ark3116_open,
724 .close = ark3116_close, 702 .close = ark3116_close,
725 .break_ctl = ark3116_break_ctl, 703 .break_ctl = ark3116_break_ctl,