diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 15:53:04 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-15 22:22:35 -0800 |
commit | 05c7cd39907184328f48d3e7899f9cdd653ad336 (patch) | |
tree | 9d1ed5c757426aa20b7eccd853faa6b519a4aa7b /drivers/usb/serial | |
parent | 92a19f9cec9a80ad93c06e115822deb729e2c6ad (diff) | |
download | linux-stable-05c7cd39907184328f48d3e7899f9cdd653ad336.tar.gz |
TTY: switch tty_insert_flip_string
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.
tty_insert_flip_string this time.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial')
26 files changed, 55 insertions, 53 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index 6d110a3bc7e7..3bb1f8f11fc8 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c @@ -119,9 +119,8 @@ static int aircable_probe(struct usb_serial *serial, return 0; } -static int aircable_process_packet(struct tty_struct *tty, - struct usb_serial_port *port, int has_headers, - char *packet, int len) +static int aircable_process_packet(struct usb_serial_port *port, + int has_headers, char *packet, int len) { if (has_headers) { len -= HCI_HEADER_LENGTH; @@ -132,7 +131,7 @@ static int aircable_process_packet(struct tty_struct *tty, return 0; } - tty_insert_flip_string(tty, packet, len); + tty_insert_flip_string(&port->port, packet, len); return len; } @@ -156,7 +155,7 @@ static void aircable_process_read_urb(struct urb *urb) count = 0; for (i = 0; i < urb->actual_length; i += HCI_COMPLETE_FRAME) { len = min_t(int, urb->actual_length - i, HCI_COMPLETE_FRAME); - count += aircable_process_packet(tty, port, has_headers, + count += aircable_process_packet(port, has_headers, &data[i], len); } diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 69a4fa1cee25..e6976a974472 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c @@ -343,7 +343,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb) return; } if (urb->actual_length) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 203358d7e7bc..498b5f0da639 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c @@ -256,7 +256,7 @@ static void send_to_tty(struct usb_serial_port *port, if (tty && actual_length) { usb_serial_debug_data(&port->dev, __func__, actual_length, data); - tty_insert_flip_string(tty, data, actual_length); + tty_insert_flip_string(&port->port, data, actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index b00110cd5689..3780f6a501b3 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -328,7 +328,7 @@ void usb_serial_generic_process_read_urb(struct urb *urb) stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases where the USB serial is not a console anyway */ if (!port->port.console || !port->sysrq) - tty_insert_flip_string(tty, ch, urb->actual_length); + tty_insert_flip_string(&port->port, ch, urb->actual_length); else { for (i = 0; i < urb->actual_length; i++, ch++) { if (!usb_serial_handle_sysrq_char(port, *ch)) diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 7b770c7f8b11..f96b91da964f 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -232,7 +232,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, unsigned char *buffer, __u16 bufferLength); static void process_rcvd_status(struct edgeport_serial *edge_serial, __u8 byte2, __u8 byte3); -static void edge_tty_recv(struct device *dev, struct tty_struct *tty, +static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, unsigned char *data, int length); static void handle_new_msr(struct edgeport_port *edge_port, __u8 newMsr); static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, @@ -1865,7 +1865,7 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial, if (tty) { dev_dbg(dev, "%s - Sending %d bytes to TTY for port %d\n", __func__, rxLen, edge_serial->rxPort); - edge_tty_recv(&edge_serial->serial->dev->dev, tty, buffer, rxLen); + edge_tty_recv(edge_port->port, tty, buffer, rxLen); tty_kref_put(tty); } edge_port->icount.rx += rxLen; @@ -2017,14 +2017,14 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, * edge_tty_recv * this function passes data on to the tty flip buffer *****************************************************************************/ -static void edge_tty_recv(struct device *dev, struct tty_struct *tty, +static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, unsigned char *data, int length) { int cnt; - cnt = tty_insert_flip_string(tty, data, length); + cnt = tty_insert_flip_string(&port->port, data, length); if (cnt < length) { - dev_err(dev, "%s - dropping data, %d bytes lost\n", + dev_err(&port->dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); } data += cnt; @@ -2090,7 +2090,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData, struct tty_struct *tty = tty_port_tty_get(&edge_port->port->port); if (tty) { - edge_tty_recv(&edge_port->port->dev, tty, &data, 1); + edge_tty_recv(edge_port->port, tty, &data, 1); tty_kref_put(tty); } } diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 58184f3de686..1286a0b2e2b7 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -201,7 +201,7 @@ static int closing_wait = EDGE_CLOSING_WAIT; static bool ignore_cpu_rev; static int default_uart_mode; /* RS232 */ -static void edge_tty_recv(struct device *dev, struct tty_struct *tty, +static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, unsigned char *data, int length); static void stop_read(struct edgeport_port *edge_port); @@ -1557,7 +1557,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data, if (lsr_data) { tty = tty_port_tty_get(&edge_port->port->port); if (tty) { - edge_tty_recv(&edge_port->port->dev, tty, &data, 1); + edge_tty_recv(edge_port->port, tty, &data, 1); tty_kref_put(tty); } } @@ -1722,7 +1722,8 @@ static void edge_bulk_in_callback(struct urb *urb) dev_dbg(dev, "%s - close pending, dropping data on the floor\n", __func__); else - edge_tty_recv(dev, tty, data, urb->actual_length); + edge_tty_recv(edge_port->port, tty, data, + urb->actual_length); edge_port->icount.rx += urb->actual_length; } tty_kref_put(tty); @@ -1740,14 +1741,14 @@ exit: dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); } -static void edge_tty_recv(struct device *dev, struct tty_struct *tty, +static void edge_tty_recv(struct usb_serial_port *port, struct tty_struct *tty, unsigned char *data, int length) { int queued; - queued = tty_insert_flip_string(tty, data, length); + queued = tty_insert_flip_string(&port->port, data, length); if (queued < length) - dev_err(dev, "%s - dropping data, %d bytes lost\n", + dev_err(&port->dev, "%s - dropping data, %d bytes lost\n", __func__, length - queued); tty_flip_buffer_push(tty); } diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index e24e2d4f4c1b..171dae1f4a62 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c @@ -305,7 +305,7 @@ static void ir_process_read_urb(struct urb *urb) tty = tty_port_tty_get(&port->port); if (!tty) return; - tty_insert_flip_string(tty, data + 1, urb->actual_length - 1); + tty_insert_flip_string(&port->port, data + 1, urb->actual_length - 1); tty_flip_buffer_push(tty); tty_kref_put(tty); } diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 1e1fbed65ef2..dd0d910730c7 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -596,7 +596,7 @@ static void read_buf_callback(struct urb *urb) if (data == NULL) dev_dbg(&port->dev, "%s - data is NULL !!!\n", __func__); if (tty && urb->actual_length && data) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index a4f5caebda43..14a219ba4ee6 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c @@ -472,7 +472,8 @@ static void usa28_indat_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); if (tty && urb->actual_length) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, + urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); @@ -688,7 +689,7 @@ static void usa49_indat_callback(struct urb *urb) /* 0x80 bit is error flag */ if ((data[0] & 0x80) == 0) { /* no error on any byte */ - tty_insert_flip_string(tty, data + 1, + tty_insert_flip_string(&port->port, data + 1, urb->actual_length - 1); } else { /* some bytes had errors, every byte has status */ @@ -816,7 +817,8 @@ static void usa90_indat_callback(struct urb *urb) otherwise looks like usa26 data format */ if (p_priv->baud > 57600) - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, + urb->actual_length); else { /* 0x80 bit is error flag */ if ((data[0] & 0x80) == 0) { diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 41b01092af07..334b1a295c6b 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c @@ -166,7 +166,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) tty = tty_port_tty_get(&port->port); /* rest of message is rx data */ if (tty && urb->actual_length) { - tty_insert_flip_string(tty, data + 1, + tty_insert_flip_string(&port->port, data + 1, urb->actual_length - 1); tty_flip_buffer_push(tty); } diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index fc9e14a1e9b3..8ee0825ad700 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c @@ -411,7 +411,7 @@ static void klsi_105_process_read_urb(struct urb *urb) len = urb->actual_length - KLSI_HDR_LEN; } - tty_insert_flip_string(tty, data + KLSI_HDR_LEN, len); + tty_insert_flip_string(&port->port, data + KLSI_HDR_LEN, len); tty_flip_buffer_push(tty); tty_kref_put(tty); } diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index b747ba615d0b..135c8b4b26f7 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c @@ -353,7 +353,7 @@ static void kobil_read_int_callback(struct urb *urb) */ /* END DEBUG */ - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index b6911757c855..ba20bb037b28 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c @@ -563,7 +563,7 @@ static void mct_u232_read_int_callback(struct urb *urb) if (urb->actual_length) { tty = tty_port_tty_get(&port->port); if (tty) { - tty_insert_flip_string(tty, data, + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } diff --git a/drivers/usb/serial/metro-usb.c b/drivers/usb/serial/metro-usb.c index 3d258448c29a..6264f3974ea7 100644 --- a/drivers/usb/serial/metro-usb.c +++ b/drivers/usb/serial/metro-usb.c @@ -127,7 +127,7 @@ static void metrousb_read_int_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); if (tty && urb->actual_length) { /* Loop through the data copying each byte to the tty layer. */ - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); /* Force the data to the tty layer. */ tty_flip_buffer_push(tty); diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index f57a6b1fe787..22818fb765e0 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c @@ -915,7 +915,7 @@ static void mos7720_bulk_in_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); if (tty && urb->actual_length) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 66d9e088d9d9..3ddd7a1f7ff3 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c @@ -773,9 +773,10 @@ static void mos7840_bulk_in_callback(struct urb *urb) usb_serial_debug_data(&port->dev, __func__, urb->actual_length, data); if (urb->actual_length) { - tty = tty_port_tty_get(&mos7840_port->port->port); + struct tty_port *tport = &mos7840_port->port->port; + tty = tty_port_tty_get(tport); if (tty) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(tport, data, urb->actual_length); tty_flip_buffer_push(tty); tty_kref_put(tty); } diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c index 1566f8f500ae..0d96a1a7b9e5 100644 --- a/drivers/usb/serial/navman.c +++ b/drivers/usb/serial/navman.c @@ -57,7 +57,7 @@ static void navman_read_int_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); if (tty && urb->actual_length) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 7818af931a48..338191bae5a3 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -176,8 +176,9 @@ static void omninet_read_bulk_callback(struct urb *urb) if (urb->actual_length && header->oh_len) { struct tty_struct *tty = tty_port_tty_get(&port->port); if (tty) { - tty_insert_flip_string(tty, data + OMNINET_DATAOFFSET, - header->oh_len); + tty_insert_flip_string(&port->port, + data + OMNINET_DATAOFFSET, + header->oh_len); tty_flip_buffer_push(tty); tty_kref_put(tty); } diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index c6bfb83efb1e..d3b74e50aff1 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c @@ -57,7 +57,7 @@ static void opticon_process_data_packet(struct usb_serial_port *port, if (!tty) return; - tty_insert_flip_string(tty, buf, len); + tty_insert_flip_string(&port->port, buf, len); tty_flip_buffer_push(tty); tty_kref_put(tty); } diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index d217fd6ee43f..7a53fe9f3af3 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c @@ -837,7 +837,7 @@ static void oti6858_read_bulk_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); if (tty != NULL && urb->actual_length > 0) { - tty_insert_flip_string(tty, data, urb->actual_length); + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } tty_kref_put(tty); diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 1e67fd89e346..5dccc4f957df 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c @@ -698,7 +698,7 @@ void qt2_process_read_urb(struct urb *urb) break; case QT2_CONTROL_ESCAPE: tty_buffer_request_room(&port->port, 2); - tty_insert_flip_string(tty, ch, 2); + tty_insert_flip_string(&port->port, ch, 2); i += 2; escapeflag = true; break; @@ -712,10 +712,8 @@ void qt2_process_read_urb(struct urb *urb) continue; } - if (tty) { - tty_buffer_request_room(&port->port, 1); - tty_insert_flip_string(tty, ch, 1); - } + tty_buffer_request_room(&port->port, 1); + tty_insert_flip_string(&port->port, ch, 1); } if (tty) { diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index c949ce6ef0c6..ad12e9e2c7ee 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c @@ -235,7 +235,7 @@ static void safe_process_read_urb(struct urb *urb) dev_info(&urb->dev->dev, "%s - actual: %d\n", __func__, actual_length); length = actual_length; out: - tty_insert_flip_string(tty, data, length); + tty_insert_flip_string(&port->port, data, length); tty_flip_buffer_push(tty); err: tty_kref_put(tty); diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index af06f2f5f38b..64e53fda149b 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -583,7 +583,7 @@ static void sierra_indat_callback(struct urb *urb) if (urb->actual_length) { tty = tty_port_tty_get(&port->port); if (tty) { - tty_insert_flip_string(tty, data, + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c index 701fffa8431f..2ffa6ae3b5ed 100644 --- a/drivers/usb/serial/symbolserial.c +++ b/drivers/usb/serial/symbolserial.c @@ -84,7 +84,8 @@ static void symbol_int_callback(struct urb *urb) */ tty = tty_port_tty_get(&port->port); if (tty) { - tty_insert_flip_string(tty, &data[1], data_length); + tty_insert_flip_string(&port->port, &data[1], + data_length); tty_flip_buffer_push(tty); tty_kref_put(tty); } diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index f2530d2ef3c4..05077e3c7631 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c @@ -121,7 +121,7 @@ static void ti_interrupt_callback(struct urb *urb); static void ti_bulk_in_callback(struct urb *urb); static void ti_bulk_out_callback(struct urb *urb); -static void ti_recv(struct device *dev, struct tty_struct *tty, +static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty, unsigned char *data, int length); static void ti_send(struct ti_port *tport); static int ti_set_mcr(struct ti_port *tport, unsigned int mcr); @@ -1155,8 +1155,7 @@ static void ti_bulk_in_callback(struct urb *urb) dev_dbg(dev, "%s - port closed, dropping data\n", __func__); else - ti_recv(&urb->dev->dev, tty, - urb->transfer_buffer, + ti_recv(port, tty, urb->transfer_buffer, urb->actual_length); spin_lock(&tport->tp_lock); tport->tp_icount.rx += urb->actual_length; @@ -1210,15 +1209,15 @@ static void ti_bulk_out_callback(struct urb *urb) } -static void ti_recv(struct device *dev, struct tty_struct *tty, +static void ti_recv(struct usb_serial_port *port, struct tty_struct *tty, unsigned char *data, int length) { int cnt; do { - cnt = tty_insert_flip_string(tty, data, length); + cnt = tty_insert_flip_string(&port->port, data, length); if (cnt < length) { - dev_err(dev, "%s - dropping data, %d bytes lost\n", + dev_err(&port->dev, "%s - dropping data, %d bytes lost\n", __func__, length - cnt); if (cnt == 0) break; diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index 01c94aada56c..293b460030cb 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -291,7 +291,7 @@ static void usb_wwan_indat_callback(struct urb *urb) tty = tty_port_tty_get(&port->port); if (tty) { if (urb->actual_length) { - tty_insert_flip_string(tty, data, + tty_insert_flip_string(&port->port, data, urb->actual_length); tty_flip_buffer_push(tty); } else |