aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_ti.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-01-03 09:53:06 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-16 01:30:15 -0500
commit2e124b4a390ca85325fae75764bef92f0547fa25 (patch)
tree5519fbcdbe954e79b271ea6d31ac5a4dc754c4f5 /drivers/usb/serial/io_ti.c
parentd6c53c0e9bd0a83f9f9ddbc9fd80141a54d83896 (diff)
TTY: switch tty_flip_buffer_push
Now, we start converting tty buffer functions to actually use tty_port. This will allow us to get rid of the need of tty in many call sites. Only tty_port will needed and hence no more tty_port_tty_get in those paths. Now, the one where most of tty_port_tty_get gets removed: tty_flip_buffer_push. IOW we also closed all the races in drivers not using tty_port_tty_get at all yet. Also we move tty_flip_buffer_push declaration from include/linux/tty.h to include/linux/tty_flip.h to all others while we are changing it anyway. Signed-off-by: Jiri Slaby <jslaby@suse.cz> 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.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index 1286a0b2e2b7..d6485be49ebf 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -201,8 +201,8 @@ static int closing_wait = EDGE_CLOSING_WAIT;
201static bool ignore_cpu_rev; 201static bool ignore_cpu_rev;
202static int default_uart_mode; /* RS232 */ 202static int default_uart_mode; /* RS232 */
203 203
204static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, 204static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
205 unsigned char *data, int length); 205 int length);
206 206
207static void stop_read(struct edgeport_port *edge_port); 207static void stop_read(struct edgeport_port *edge_port);
208static int restart_read(struct edgeport_port *edge_port); 208static int restart_read(struct edgeport_port *edge_port);
@@ -1540,7 +1540,6 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
1540 struct async_icount *icount; 1540 struct async_icount *icount;
1541 __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR | 1541 __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR |
1542 LSR_FRM_ERR | LSR_BREAK)); 1542 LSR_FRM_ERR | LSR_BREAK));
1543 struct tty_struct *tty;
1544 1543
1545 dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr); 1544 dev_dbg(&edge_port->port->dev, "%s - %02x\n", __func__, new_lsr);
1546 1545
@@ -1554,13 +1553,8 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
1554 new_lsr &= (__u8)(LSR_OVER_ERR | LSR_BREAK); 1553 new_lsr &= (__u8)(LSR_OVER_ERR | LSR_BREAK);
1555 1554
1556 /* Place LSR data byte into Rx buffer */ 1555 /* Place LSR data byte into Rx buffer */
1557 if (lsr_data) { 1556 if (lsr_data)
1558 tty = tty_port_tty_get(&edge_port->port->port); 1557 edge_tty_recv(edge_port->port, &data, 1);
1559 if (tty) {
1560 edge_tty_recv(edge_port->port, tty, &data, 1);
1561 tty_kref_put(tty);
1562 }
1563 }
1564 1558
1565 /* update input line counters */ 1559 /* update input line counters */
1566 icount = &edge_port->icount; 1560 icount = &edge_port->icount;
@@ -1676,7 +1670,6 @@ static void edge_bulk_in_callback(struct urb *urb)
1676 struct edgeport_port *edge_port = urb->context; 1670 struct edgeport_port *edge_port = urb->context;
1677 struct device *dev = &edge_port->port->dev; 1671 struct device *dev = &edge_port->port->dev;
1678 unsigned char *data = urb->transfer_buffer; 1672 unsigned char *data = urb->transfer_buffer;
1679 struct tty_struct *tty;
1680 int retval = 0; 1673 int retval = 0;
1681 int port_number; 1674 int port_number;
1682 int status = urb->status; 1675 int status = urb->status;
@@ -1715,18 +1708,16 @@ static void edge_bulk_in_callback(struct urb *urb)
1715 ++data; 1708 ++data;
1716 } 1709 }
1717 1710
1718 tty = tty_port_tty_get(&edge_port->port->port); 1711 if (urb->actual_length) {
1719 if (tty && urb->actual_length) {
1720 usb_serial_debug_data(dev, __func__, urb->actual_length, data); 1712 usb_serial_debug_data(dev, __func__, urb->actual_length, data);
1721 if (edge_port->close_pending) 1713 if (edge_port->close_pending)
1722 dev_dbg(dev, "%s - close pending, dropping data on the floor\n", 1714 dev_dbg(dev, "%s - close pending, dropping data on the floor\n",
1723 __func__); 1715 __func__);
1724 else 1716 else
1725 edge_tty_recv(edge_port->port, tty, data, 1717 edge_tty_recv(edge_port->port, data,
1726 urb->actual_length); 1718 urb->actual_length);
1727 edge_port->icount.rx += urb->actual_length; 1719 edge_port->icount.rx += urb->actual_length;
1728 } 1720 }
1729 tty_kref_put(tty);
1730 1721
1731exit: 1722exit:
1732 /* continue read unless stopped */ 1723 /* continue read unless stopped */
@@ -1741,8 +1732,8 @@ exit:
1741 dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); 1732 dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval);
1742} 1733}
1743 1734
1744static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, 1735static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
1745 unsigned char *data, int length) 1736 int length)
1746{ 1737{
1747 int queued; 1738 int queued;
1748 1739
@@ -1750,7 +1741,7 @@ static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
1750 if (queued < length) 1741 if (queued < length)
1751 dev_err(&port->dev, "%s - dropping data, %d bytes lost\n", 1742 dev_err(&port->dev, "%s - dropping data, %d bytes lost\n",
1752 __func__, length - queued); 1743 __func__, length - queued);
1753 tty_flip_buffer_push(tty); 1744 tty_flip_buffer_push(&port->port);
1754} 1745}
1755 1746
1756static void edge_bulk_out_callback(struct urb *urb) 1747static void edge_bulk_out_callback(struct urb *urb)