diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-03-21 07:37:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-25 16:52:28 -0400 |
commit | 31ecdb6befeab20d93b49b8dd640c081b48912d0 (patch) | |
tree | 9932bdf637a56e77f673332d17537ef981ce2179 /drivers/usb/serial/ssu100.c | |
parent | e1ed212d8593f8d5036709ae257e0e019dbecd4f (diff) |
USB: ssu100: 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/ssu100.c')
-rw-r--r-- | drivers/usb/serial/ssu100.c | 55 |
1 files changed, 15 insertions, 40 deletions
diff --git a/drivers/usb/serial/ssu100.c b/drivers/usb/serial/ssu100.c index 45b8c29060d1..8d94a5a7c4b6 100644 --- a/drivers/usb/serial/ssu100.c +++ b/drivers/usb/serial/ssu100.c | |||
@@ -61,7 +61,6 @@ struct ssu100_port_private { | |||
61 | spinlock_t status_lock; | 61 | spinlock_t status_lock; |
62 | u8 shadowLSR; | 62 | u8 shadowLSR; |
63 | u8 shadowMSR; | 63 | u8 shadowMSR; |
64 | struct async_icount icount; | ||
65 | }; | 64 | }; |
66 | 65 | ||
67 | static inline int ssu100_control_msg(struct usb_device *dev, | 66 | static inline int ssu100_control_msg(struct usb_device *dev, |
@@ -345,16 +344,16 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
345 | unsigned long flags; | 344 | unsigned long flags; |
346 | 345 | ||
347 | spin_lock_irqsave(&priv->status_lock, flags); | 346 | spin_lock_irqsave(&priv->status_lock, flags); |
348 | prev = priv->icount; | 347 | prev = port->icount; |
349 | spin_unlock_irqrestore(&priv->status_lock, flags); | 348 | spin_unlock_irqrestore(&priv->status_lock, flags); |
350 | 349 | ||
351 | while (1) { | 350 | while (1) { |
352 | wait_event_interruptible(port->delta_msr_wait, | 351 | wait_event_interruptible(port->delta_msr_wait, |
353 | (port->serial->disconnected || | 352 | (port->serial->disconnected || |
354 | (priv->icount.rng != prev.rng) || | 353 | (port->icount.rng != prev.rng) || |
355 | (priv->icount.dsr != prev.dsr) || | 354 | (port->icount.dsr != prev.dsr) || |
356 | (priv->icount.dcd != prev.dcd) || | 355 | (port->icount.dcd != prev.dcd) || |
357 | (priv->icount.cts != prev.cts))); | 356 | (port->icount.cts != prev.cts))); |
358 | 357 | ||
359 | if (signal_pending(current)) | 358 | if (signal_pending(current)) |
360 | return -ERESTARTSYS; | 359 | return -ERESTARTSYS; |
@@ -363,7 +362,7 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
363 | return -EIO; | 362 | return -EIO; |
364 | 363 | ||
365 | spin_lock_irqsave(&priv->status_lock, flags); | 364 | spin_lock_irqsave(&priv->status_lock, flags); |
366 | cur = priv->icount; | 365 | cur = port->icount; |
367 | spin_unlock_irqrestore(&priv->status_lock, flags); | 366 | spin_unlock_irqrestore(&priv->status_lock, flags); |
368 | 367 | ||
369 | if ((prev.rng == cur.rng) && | 368 | if ((prev.rng == cur.rng) && |
@@ -381,30 +380,6 @@ static int wait_modem_info(struct usb_serial_port *port, unsigned int arg) | |||
381 | return 0; | 380 | return 0; |
382 | } | 381 | } |
383 | 382 | ||
384 | static int ssu100_get_icount(struct tty_struct *tty, | ||
385 | struct serial_icounter_struct *icount) | ||
386 | { | ||
387 | struct usb_serial_port *port = tty->driver_data; | ||
388 | struct ssu100_port_private *priv = usb_get_serial_port_data(port); | ||
389 | struct async_icount cnow = priv->icount; | ||
390 | |||
391 | icount->cts = cnow.cts; | ||
392 | icount->dsr = cnow.dsr; | ||
393 | icount->rng = cnow.rng; | ||
394 | icount->dcd = cnow.dcd; | ||
395 | icount->rx = cnow.rx; | ||
396 | icount->tx = cnow.tx; | ||
397 | icount->frame = cnow.frame; | ||
398 | icount->overrun = cnow.overrun; | ||
399 | icount->parity = cnow.parity; | ||
400 | icount->brk = cnow.brk; | ||
401 | icount->buf_overrun = cnow.buf_overrun; | ||
402 | |||
403 | return 0; | ||
404 | } | ||
405 | |||
406 | |||
407 | |||
408 | static int ssu100_ioctl(struct tty_struct *tty, | 383 | static int ssu100_ioctl(struct tty_struct *tty, |
409 | unsigned int cmd, unsigned long arg) | 384 | unsigned int cmd, unsigned long arg) |
410 | { | 385 | { |
@@ -527,13 +502,13 @@ static void ssu100_update_msr(struct usb_serial_port *port, u8 msr) | |||
527 | if (msr & UART_MSR_ANY_DELTA) { | 502 | if (msr & UART_MSR_ANY_DELTA) { |
528 | /* update input line counters */ | 503 | /* update input line counters */ |
529 | if (msr & UART_MSR_DCTS) | 504 | if (msr & UART_MSR_DCTS) |
530 | priv->icount.cts++; | 505 | port->icount.cts++; |
531 | if (msr & UART_MSR_DDSR) | 506 | if (msr & UART_MSR_DDSR) |
532 | priv->icount.dsr++; | 507 | port->icount.dsr++; |
533 | if (msr & UART_MSR_DDCD) | 508 | if (msr & UART_MSR_DDCD) |
534 | priv->icount.dcd++; | 509 | port->icount.dcd++; |
535 | if (msr & UART_MSR_TERI) | 510 | if (msr & UART_MSR_TERI) |
536 | priv->icount.rng++; | 511 | port->icount.rng++; |
537 | wake_up_interruptible(&port->delta_msr_wait); | 512 | wake_up_interruptible(&port->delta_msr_wait); |
538 | } | 513 | } |
539 | } | 514 | } |
@@ -553,22 +528,22 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr, | |||
553 | /* we always want to update icount, but we only want to | 528 | /* we always want to update icount, but we only want to |
554 | * update tty_flag for one case */ | 529 | * update tty_flag for one case */ |
555 | if (lsr & UART_LSR_BI) { | 530 | if (lsr & UART_LSR_BI) { |
556 | priv->icount.brk++; | 531 | port->icount.brk++; |
557 | *tty_flag = TTY_BREAK; | 532 | *tty_flag = TTY_BREAK; |
558 | usb_serial_handle_break(port); | 533 | usb_serial_handle_break(port); |
559 | } | 534 | } |
560 | if (lsr & UART_LSR_PE) { | 535 | if (lsr & UART_LSR_PE) { |
561 | priv->icount.parity++; | 536 | port->icount.parity++; |
562 | if (*tty_flag == TTY_NORMAL) | 537 | if (*tty_flag == TTY_NORMAL) |
563 | *tty_flag = TTY_PARITY; | 538 | *tty_flag = TTY_PARITY; |
564 | } | 539 | } |
565 | if (lsr & UART_LSR_FE) { | 540 | if (lsr & UART_LSR_FE) { |
566 | priv->icount.frame++; | 541 | port->icount.frame++; |
567 | if (*tty_flag == TTY_NORMAL) | 542 | if (*tty_flag == TTY_NORMAL) |
568 | *tty_flag = TTY_FRAME; | 543 | *tty_flag = TTY_FRAME; |
569 | } | 544 | } |
570 | if (lsr & UART_LSR_OE){ | 545 | if (lsr & UART_LSR_OE){ |
571 | priv->icount.overrun++; | 546 | port->icount.overrun++; |
572 | if (*tty_flag == TTY_NORMAL) | 547 | if (*tty_flag == TTY_NORMAL) |
573 | *tty_flag = TTY_OVERRUN; | 548 | *tty_flag = TTY_OVERRUN; |
574 | } | 549 | } |
@@ -632,7 +607,7 @@ static struct usb_serial_driver ssu100_device = { | |||
632 | .process_read_urb = ssu100_process_read_urb, | 607 | .process_read_urb = ssu100_process_read_urb, |
633 | .tiocmget = ssu100_tiocmget, | 608 | .tiocmget = ssu100_tiocmget, |
634 | .tiocmset = ssu100_tiocmset, | 609 | .tiocmset = ssu100_tiocmset, |
635 | .get_icount = ssu100_get_icount, | 610 | .get_icount = usb_serial_generic_get_icount, |
636 | .ioctl = ssu100_ioctl, | 611 | .ioctl = ssu100_ioctl, |
637 | .set_termios = ssu100_set_termios, | 612 | .set_termios = ssu100_set_termios, |
638 | }; | 613 | }; |