aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/io_edgeport.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_edgeport.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_edgeport.c')
-rw-r--r--drivers/usb/serial/io_edgeport.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index f96b91da964f..b00e5cbf741f 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -232,8 +232,8 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
232 unsigned char *buffer, __u16 bufferLength); 232 unsigned char *buffer, __u16 bufferLength);
233static void process_rcvd_status(struct edgeport_serial *edge_serial, 233static void process_rcvd_status(struct edgeport_serial *edge_serial,
234 __u8 byte2, __u8 byte3); 234 __u8 byte2, __u8 byte3);
235static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, 235static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
236 unsigned char *data, int length); 236 int length);
237static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr); 237static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr);
238static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, 238static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
239 __u8 lsr, __u8 data); 239 __u8 lsr, __u8 data);
@@ -1752,7 +1752,6 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
1752 struct device *dev = &edge_serial->serial->dev->dev; 1752 struct device *dev = &edge_serial->serial->dev->dev;
1753 struct usb_serial_port *port; 1753 struct usb_serial_port *port;
1754 struct edgeport_port *edge_port; 1754 struct edgeport_port *edge_port;
1755 struct tty_struct *tty;
1756 __u16 lastBufferLength; 1755 __u16 lastBufferLength;
1757 __u16 rxLen; 1756 __u16 rxLen;
1758 1757
@@ -1860,14 +1859,11 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
1860 edge_serial->rxPort]; 1859 edge_serial->rxPort];
1861 edge_port = usb_get_serial_port_data(port); 1860 edge_port = usb_get_serial_port_data(port);
1862 if (edge_port->open) { 1861 if (edge_port->open) {
1863 tty = tty_port_tty_get( 1862 dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n",
1864 &edge_port->port->port); 1863 __func__, rxLen,
1865 if (tty) { 1864 edge_serial->rxPort);
1866 dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", 1865 edge_tty_recv(edge_port->port, buffer,
1867 __func__, rxLen, edge_serial->rxPort); 1866 rxLen);
1868 edge_tty_recv(edge_port->port, tty, buffer, rxLen);
1869 tty_kref_put(tty);
1870 }
1871 edge_port->icount.rx += rxLen; 1867 edge_port->icount.rx += rxLen;
1872 } 1868 }
1873 buffer += rxLen; 1869 buffer += rxLen;
@@ -2017,8 +2013,8 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
2017 * edge_tty_recv 2013 * edge_tty_recv
2018 * this function passes data on to the tty flip buffer 2014 * this function passes data on to the tty flip buffer
2019 *****************************************************************************/ 2015 *****************************************************************************/
2020static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, 2016static void edge_tty_recv(struct usb_serial_port *port, unsigned char *data,
2021 unsigned char *data, int length) 2017 int length)
2022{ 2018{
2023 int cnt; 2019 int cnt;
2024 2020
@@ -2030,7 +2026,7 @@ static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty,
2030 data += cnt; 2026 data += cnt;
2031 length -= cnt; 2027 length -= cnt;
2032 2028
2033 tty_flip_buffer_push(tty); 2029 tty_flip_buffer_push(&port->port);
2034} 2030}
2035 2031
2036 2032
@@ -2086,14 +2082,9 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
2086 } 2082 }
2087 2083
2088 /* Place LSR data byte into Rx buffer */ 2084 /* Place LSR data byte into Rx buffer */
2089 if (lsrData) { 2085 if (lsrData)
2090 struct tty_struct *tty = 2086 edge_tty_recv(edge_port->port, &data, 1);
2091 tty_port_tty_get(&edge_port->port->port); 2087
2092 if (tty) {
2093 edge_tty_recv(edge_port->port, tty, &data, 1);
2094 tty_kref_put(tty);
2095 }
2096 }
2097 /* update input line counters */ 2088 /* update input line counters */
2098 icount = &edge_port->icount; 2089 icount = &edge_port->icount;
2099 if (newLsr & LSR_BREAK) 2090 if (newLsr & LSR_BREAK)