diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-03-21 07:37:33 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-25 16:52:28 -0400 |
commit | 783ca3557b83b915d1b7a47240e7ab6acca0aac8 (patch) | |
tree | 4d4b8d40b9765544644d378a60616dee88c7d505 /drivers/usb/serial/ti_usb_3410_5052.c | |
parent | c24c838e8effd55ba330d1966d9846400af4bec8 (diff) |
USB: ti_usb_3410_5052: 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/ti_usb_3410_5052.c')
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 44 |
1 files changed, 7 insertions, 37 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 73deb029fc05..999772538374 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -73,7 +73,6 @@ struct ti_port { | |||
73 | unsigned int tp_uart_base_addr; | 73 | unsigned int tp_uart_base_addr; |
74 | int tp_flags; | 74 | int tp_flags; |
75 | int tp_closing_wait;/* in .01 secs */ | 75 | int tp_closing_wait;/* in .01 secs */ |
76 | struct async_icount tp_icount; | ||
77 | wait_queue_head_t tp_write_wait; | 76 | wait_queue_head_t tp_write_wait; |
78 | struct ti_device *tp_tdev; | 77 | struct ti_device *tp_tdev; |
79 | struct usb_serial_port *tp_port; | 78 | struct usb_serial_port *tp_port; |
@@ -108,8 +107,6 @@ static void ti_throttle(struct tty_struct *tty); | |||
108 | static void ti_unthrottle(struct tty_struct *tty); | 107 | static void ti_unthrottle(struct tty_struct *tty); |
109 | static int ti_ioctl(struct tty_struct *tty, | 108 | static int ti_ioctl(struct tty_struct *tty, |
110 | unsigned int cmd, unsigned long arg); | 109 | unsigned int cmd, unsigned long arg); |
111 | static int ti_get_icount(struct tty_struct *tty, | ||
112 | struct serial_icounter_struct *icount); | ||
113 | static void ti_set_termios(struct tty_struct *tty, | 110 | static void ti_set_termios(struct tty_struct *tty, |
114 | struct usb_serial_port *port, struct ktermios *old_termios); | 111 | struct usb_serial_port *port, struct ktermios *old_termios); |
115 | static int ti_tiocmget(struct tty_struct *tty); | 112 | static int ti_tiocmget(struct tty_struct *tty); |
@@ -235,7 +232,7 @@ static struct usb_serial_driver ti_1port_device = { | |||
235 | .set_termios = ti_set_termios, | 232 | .set_termios = ti_set_termios, |
236 | .tiocmget = ti_tiocmget, | 233 | .tiocmget = ti_tiocmget, |
237 | .tiocmset = ti_tiocmset, | 234 | .tiocmset = ti_tiocmset, |
238 | .get_icount = ti_get_icount, | 235 | .get_icount = usb_serial_generic_get_icount, |
239 | .break_ctl = ti_break, | 236 | .break_ctl = ti_break, |
240 | .read_int_callback = ti_interrupt_callback, | 237 | .read_int_callback = ti_interrupt_callback, |
241 | .read_bulk_callback = ti_bulk_in_callback, | 238 | .read_bulk_callback = ti_bulk_in_callback, |
@@ -265,7 +262,7 @@ static struct usb_serial_driver ti_2port_device = { | |||
265 | .set_termios = ti_set_termios, | 262 | .set_termios = ti_set_termios, |
266 | .tiocmget = ti_tiocmget, | 263 | .tiocmget = ti_tiocmget, |
267 | .tiocmset = ti_tiocmset, | 264 | .tiocmset = ti_tiocmset, |
268 | .get_icount = ti_get_icount, | 265 | .get_icount = usb_serial_generic_get_icount, |
269 | .break_ctl = ti_break, | 266 | .break_ctl = ti_break, |
270 | .read_int_callback = ti_interrupt_callback, | 267 | .read_int_callback = ti_interrupt_callback, |
271 | .read_bulk_callback = ti_bulk_in_callback, | 268 | .read_bulk_callback = ti_bulk_in_callback, |
@@ -480,8 +477,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
480 | 477 | ||
481 | port_number = port->number - port->serial->minor; | 478 | port_number = port->number - port->serial->minor; |
482 | 479 | ||
483 | memset(&(tport->tp_icount), 0x00, sizeof(tport->tp_icount)); | ||
484 | |||
485 | tport->tp_msr = 0; | 480 | tport->tp_msr = 0; |
486 | tport->tp_shadow_mcr |= (TI_MCR_RTS | TI_MCR_DTR); | 481 | tport->tp_shadow_mcr |= (TI_MCR_RTS | TI_MCR_DTR); |
487 | 482 | ||
@@ -731,31 +726,6 @@ static void ti_unthrottle(struct tty_struct *tty) | |||
731 | } | 726 | } |
732 | } | 727 | } |
733 | 728 | ||
734 | static int ti_get_icount(struct tty_struct *tty, | ||
735 | struct serial_icounter_struct *icount) | ||
736 | { | ||
737 | struct usb_serial_port *port = tty->driver_data; | ||
738 | struct ti_port *tport = usb_get_serial_port_data(port); | ||
739 | struct async_icount cnow = tport->tp_icount; | ||
740 | |||
741 | dev_dbg(&port->dev, "%s - TIOCGICOUNT RX=%d, TX=%d\n", __func__, | ||
742 | cnow.rx, cnow.tx); | ||
743 | |||
744 | icount->cts = cnow.cts; | ||
745 | icount->dsr = cnow.dsr; | ||
746 | icount->rng = cnow.rng; | ||
747 | icount->dcd = cnow.dcd; | ||
748 | icount->rx = cnow.rx; | ||
749 | icount->tx = cnow.tx; | ||
750 | icount->frame = cnow.frame; | ||
751 | icount->overrun = cnow.overrun; | ||
752 | icount->parity = cnow.parity; | ||
753 | icount->brk = cnow.brk; | ||
754 | icount->buf_overrun = cnow.buf_overrun; | ||
755 | |||
756 | return 0; | ||
757 | } | ||
758 | |||
759 | static int ti_ioctl(struct tty_struct *tty, | 729 | static int ti_ioctl(struct tty_struct *tty, |
760 | unsigned int cmd, unsigned long arg) | 730 | unsigned int cmd, unsigned long arg) |
761 | { | 731 | { |
@@ -780,7 +750,7 @@ static int ti_ioctl(struct tty_struct *tty, | |||
780 | (struct serial_struct __user *)arg); | 750 | (struct serial_struct __user *)arg); |
781 | case TIOCMIWAIT: | 751 | case TIOCMIWAIT: |
782 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); | 752 | dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); |
783 | cprev = tport->tp_icount; | 753 | cprev = port->icount; |
784 | while (1) { | 754 | while (1) { |
785 | interruptible_sleep_on(&port->delta_msr_wait); | 755 | interruptible_sleep_on(&port->delta_msr_wait); |
786 | if (signal_pending(current)) | 756 | if (signal_pending(current)) |
@@ -789,7 +759,7 @@ static int ti_ioctl(struct tty_struct *tty, | |||
789 | if (port->serial->disconnected) | 759 | if (port->serial->disconnected) |
790 | return -EIO; | 760 | return -EIO; |
791 | 761 | ||
792 | cnow = tport->tp_icount; | 762 | cnow = port->icount; |
793 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | 763 | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && |
794 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) | 764 | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) |
795 | return -EIO; /* no change => error */ | 765 | return -EIO; /* no change => error */ |
@@ -1156,7 +1126,7 @@ static void ti_bulk_in_callback(struct urb *urb) | |||
1156 | else | 1126 | else |
1157 | ti_recv(port, urb->transfer_buffer, urb->actual_length); | 1127 | ti_recv(port, urb->transfer_buffer, urb->actual_length); |
1158 | spin_lock(&tport->tp_lock); | 1128 | spin_lock(&tport->tp_lock); |
1159 | tport->tp_icount.rx += urb->actual_length; | 1129 | port->icount.rx += urb->actual_length; |
1160 | spin_unlock(&tport->tp_lock); | 1130 | spin_unlock(&tport->tp_lock); |
1161 | } | 1131 | } |
1162 | 1132 | ||
@@ -1265,7 +1235,7 @@ static void ti_send(struct ti_port *tport) | |||
1265 | /* TODO: reschedule ti_send */ | 1235 | /* TODO: reschedule ti_send */ |
1266 | } else { | 1236 | } else { |
1267 | spin_lock_irqsave(&tport->tp_lock, flags); | 1237 | spin_lock_irqsave(&tport->tp_lock, flags); |
1268 | tport->tp_icount.tx += count; | 1238 | port->icount.tx += count; |
1269 | spin_unlock_irqrestore(&tport->tp_lock, flags); | 1239 | spin_unlock_irqrestore(&tport->tp_lock, flags); |
1270 | } | 1240 | } |
1271 | 1241 | ||
@@ -1385,7 +1355,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr) | |||
1385 | 1355 | ||
1386 | if (msr & TI_MSR_DELTA_MASK) { | 1356 | if (msr & TI_MSR_DELTA_MASK) { |
1387 | spin_lock_irqsave(&tport->tp_lock, flags); | 1357 | spin_lock_irqsave(&tport->tp_lock, flags); |
1388 | icount = &tport->tp_icount; | 1358 | icount = &tport->tp_port->icount; |
1389 | if (msr & TI_MSR_DELTA_CTS) | 1359 | if (msr & TI_MSR_DELTA_CTS) |
1390 | icount->cts++; | 1360 | icount->cts++; |
1391 | if (msr & TI_MSR_DELTA_DSR) | 1361 | if (msr & TI_MSR_DELTA_DSR) |