aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 07:37:09 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-25 16:50:53 -0400
commitcf9a9d66bd29f32011d271695ffaa289489b3a7d (patch)
tree2ad299e89ea21dd5108bcda9c98dc5bd6c3ac527 /drivers/usb/serial/io_ti.c
parent8b8070d8580c38e15979b2a88f3a4d7b02bd3bde (diff)
USB: io_ti: switch to generic get_icount implementation
Switch to the generic get_icount implementation. Note that the interrupt counters will no longer be reset at open which is in accordance with which how the other drivers work. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r--drivers/usb/serial/io_ti.c40
1 files changed, 8 insertions, 32 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 7777172206de..fb9e66480f17 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -86,7 +86,6 @@ struct edgeport_port {
86 int baud_rate; 86 int baud_rate;
87 int close_pending; 87 int close_pending;
88 int lsr_event; 88 int lsr_event;
89 struct async_icount icount;
90 struct edgeport_serial *edge_serial; 89 struct edgeport_serial *edge_serial;
91 struct usb_serial_port *port; 90 struct usb_serial_port *port;
92 __u8 bUartMode; /* Port type, 0: RS232, etc. */ 91 __u8 bUartMode; /* Port type, 0: RS232, etc. */
@@ -1445,7 +1444,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr)
1445 1444
1446 if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR | 1445 if (msr & (EDGEPORT_MSR_DELTA_CTS | EDGEPORT_MSR_DELTA_DSR |
1447 EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) { 1446 EDGEPORT_MSR_DELTA_RI | EDGEPORT_MSR_DELTA_CD)) {
1448 icount = &edge_port->icount; 1447 icount = &edge_port->port->icount;
1449 1448
1450 /* update input line counters */ 1449 /* update input line counters */
1451 if (msr & EDGEPORT_MSR_DELTA_CTS) 1450 if (msr & EDGEPORT_MSR_DELTA_CTS)
@@ -1498,7 +1497,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
1498 edge_tty_recv(edge_port->port, &data, 1); 1497 edge_tty_recv(edge_port->port, &data, 1);
1499 1498
1500 /* update input line counters */ 1499 /* update input line counters */
1501 icount = &edge_port->icount; 1500 icount = &edge_port->port->icount;
1502 if (new_lsr & LSR_BREAK) 1501 if (new_lsr & LSR_BREAK)
1503 icount->brk++; 1502 icount->brk++;
1504 if (new_lsr & LSR_OVER_ERR) 1503 if (new_lsr & LSR_OVER_ERR)
@@ -1657,7 +1656,7 @@ static void edge_bulk_in_callback(struct urb *urb)
1657 else 1656 else
1658 edge_tty_recv(edge_port->port, data, 1657 edge_tty_recv(edge_port->port, data,
1659 urb->actual_length); 1658 urb->actual_length);
1660 edge_port->icount.rx += urb->actual_length; 1659 edge_port->port->icount.rx += urb->actual_length;
1661 } 1660 }
1662 1661
1663exit: 1662exit:
@@ -1750,8 +1749,6 @@ static int edge_open(struct tty_struct *tty, struct usb_serial_port *port)
1750 1749
1751 dev = port->serial->dev; 1750 dev = port->serial->dev;
1752 1751
1753 memset(&(edge_port->icount), 0x00, sizeof(edge_port->icount));
1754
1755 /* turn off loopback */ 1752 /* turn off loopback */
1756 status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0); 1753 status = ti_do_config(edge_port, UMPC_SET_CLR_LOOPBACK, 0);
1757 if (status) { 1754 if (status) {
@@ -1999,7 +1996,7 @@ static void edge_send(struct tty_struct *tty)
1999 edge_port->ep_write_urb_in_use = 0; 1996 edge_port->ep_write_urb_in_use = 0;
2000 /* TODO: reschedule edge_send */ 1997 /* TODO: reschedule edge_send */
2001 } else 1998 } else
2002 edge_port->icount.tx += count; 1999 edge_port->port->icount.tx += count;
2003 2000
2004 /* wakeup any process waiting for writes to complete */ 2001 /* wakeup any process waiting for writes to complete */
2005 /* there is now more room in the buffer for new writes */ 2002 /* there is now more room in the buffer for new writes */
@@ -2360,27 +2357,6 @@ static int edge_tiocmget(struct tty_struct *tty)
2360 return result; 2357 return result;
2361} 2358}
2362 2359
2363static int edge_get_icount(struct tty_struct *tty,
2364 struct serial_icounter_struct *icount)
2365{
2366 struct usb_serial_port *port = tty->driver_data;
2367 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
2368 struct async_icount *ic = &edge_port->icount;
2369
2370 icount->cts = ic->cts;
2371 icount->dsr = ic->dsr;
2372 icount->rng = ic->rng;
2373 icount->dcd = ic->dcd;
2374 icount->tx = ic->tx;
2375 icount->rx = ic->rx;
2376 icount->frame = ic->frame;
2377 icount->parity = ic->parity;
2378 icount->overrun = ic->overrun;
2379 icount->brk = ic->brk;
2380 icount->buf_overrun = ic->buf_overrun;
2381 return 0;
2382}
2383
2384static int get_serial_info(struct edgeport_port *edge_port, 2360static int get_serial_info(struct edgeport_port *edge_port,
2385 struct serial_struct __user *retinfo) 2361 struct serial_struct __user *retinfo)
2386{ 2362{
@@ -2428,7 +2404,7 @@ static int edge_ioctl(struct tty_struct *tty,
2428 (struct serial_struct __user *) arg); 2404 (struct serial_struct __user *) arg);
2429 case TIOCMIWAIT: 2405 case TIOCMIWAIT:
2430 dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__); 2406 dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__);
2431 cprev = edge_port->icount; 2407 cprev = edge_port->port->icount;
2432 while (1) { 2408 while (1) {
2433 interruptible_sleep_on(&port->delta_msr_wait); 2409 interruptible_sleep_on(&port->delta_msr_wait);
2434 /* see if a signal did it */ 2410 /* see if a signal did it */
@@ -2438,7 +2414,7 @@ static int edge_ioctl(struct tty_struct *tty,
2438 if (port->serial->disconnected) 2414 if (port->serial->disconnected)
2439 return -EIO; 2415 return -EIO;
2440 2416
2441 cnow = edge_port->icount; 2417 cnow = port->icount;
2442 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && 2418 if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
2443 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) 2419 cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
2444 return -EIO; /* no change => error */ 2420 return -EIO; /* no change => error */
@@ -2618,7 +2594,7 @@ static struct usb_serial_driver edgeport_1port_device = {
2618 .set_termios = edge_set_termios, 2594 .set_termios = edge_set_termios,
2619 .tiocmget = edge_tiocmget, 2595 .tiocmget = edge_tiocmget,
2620 .tiocmset = edge_tiocmset, 2596 .tiocmset = edge_tiocmset,
2621 .get_icount = edge_get_icount, 2597 .get_icount = usb_serial_generic_get_icount,
2622 .write = edge_write, 2598 .write = edge_write,
2623 .write_room = edge_write_room, 2599 .write_room = edge_write_room,
2624 .chars_in_buffer = edge_chars_in_buffer, 2600 .chars_in_buffer = edge_chars_in_buffer,
@@ -2649,7 +2625,7 @@ static struct usb_serial_driver edgeport_2port_device = {
2649 .set_termios = edge_set_termios, 2625 .set_termios = edge_set_termios,
2650 .tiocmget = edge_tiocmget, 2626 .tiocmget = edge_tiocmget,
2651 .tiocmset = edge_tiocmset, 2627 .tiocmset = edge_tiocmset,
2652 .get_icount = edge_get_icount, 2628 .get_icount = usb_serial_generic_get_icount,
2653 .write = edge_write, 2629 .write = edge_write,
2654 .write_room = edge_write_room, 2630 .write_room = edge_write_room,
2655 .chars_in_buffer = edge_chars_in_buffer, 2631 .chars_in_buffer = edge_chars_in_buffer,